How to include chromedriver with pyinstaller?

后端 未结 1 880
刺人心
刺人心 2020-12-14 11:16

I am using pyinstaller to create an executable of my python script.
In the script I\'m using these imports:

from selenium import webdriver
from selenium.         


        
1条回答
  •  离开以前
    2020-12-14 12:00

    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

    0 讨论(0)
提交回复
热议问题