How to include chromedriver with pyinstaller? How to include chromedriver with pyinstaller? selenium selenium

How to include chromedriver with pyinstaller?


It should be added as a binary file, since it is a binary file...
So a custom spec file needed where the chromedriver's path on the local system and the desired location relative to the dist\myscript should be defined, so it looks something like this:

.....a = Analysis(['myscript.py'],             pathex=['path\\to\\my\\script'],             binaries=[ ('path\\to\\my\\chromedriver.exe', '.\\selenium\\webdriver') ],             datas=None,....

And then run the pyinstaller with this spec file: pyinstaller myscript.spec myscript.py