[英]Pyinstaller gives “ 'chromedriver.exe' executable needs to be in PATH” when the .exe is ran, but the actual python script works fine
So I have a python script that uses selenium and everything works perfectly fine when I run it, but I wanted to turn it into a.exe file so I used pyinstaller.所以我有一个使用 selenium 的 python 脚本,当我运行它时一切正常,但我想把它变成一个 .exe 文件,所以我使用了 pyinstaller。 I made the spec files n stuff but when I actually run the.exe I get
chromedriver.exe' executable needs to be in PATH
when normally I dont get that when I run the python script我制作了规范文件n的东西,但是当我实际运行.exe时,我得到
chromedriver.exe' executable needs to be in PATH
中,而当我运行python脚本时通常我没有得到它
here is a code snippet of my actual python script where I set the path.这是我设置路径的实际 python 脚本的代码片段。
path = os.getcwd()
if (browser == 'c'):
driver_path = path + '//chromedriver_win32//chromedriver.exe'
options = webdriver.ChromeOptions()
options.add_argument("--mute-audio")
if (hidden == 'T'): options.add_argument('headless')
driver = webdriver.Chrome(executable_path=driver_path, options=options)
if (browser == 'f'):
driver_path = path + '//geckodriver-v0.26.0-win64//geckodriver.exe'
options = webdriver.FirefoxOptions()
options.add_argument("--mute-audio")
if (hidden == 'T'): options.add_argument('headless')
driver = webdriver.Firefox(executable_path=driver_path, options=options)
If you need any more code just let me know.如果您需要更多代码,请告诉我。
The directory with chromepath wasn't in the correct place.带有 chromepath 的目录不在正确的位置。 Make sure to double check your directory hierarchy.
确保仔细检查您的目录层次结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.