简体   繁体   English

Pyinstaller 在运行 .exe 时给出“'chromedriver.exe' 可执行文件需要在 PATH 中”,但实际的 python 脚本工作正常

[英]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.

相关问题 我收到消息“chromedriver.exe”可执行文件需要在 PATH 中 - i got message 'chromedriver.exe' executable needs to be in PATH Selenium WebDriverException:消息:“ chromedriver.exe”可执行文件必须位于PATH中 - Selenium WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH 如何修复“chromedriver.exe”可执行文件需要在 Github Actions 的 PATH 中? - How to fix 'chromedriver.exe' executable needs to be in PATH` in Github Actions? 如何修复 Selenium 错误(Python) - 消息:“chromedriver.exe”可执行文件需要在 PATH 中 - How to fix Selenium Error (Python) - Message: 'chromedriver.exe' executable needs to be in PATH Selenium WebDriverException 'chromedriver.exe' 需要在 PATH 中 - Selenium WebDriverException 'chromedriver.exe' needs to be in PATH 为 Windows - selenium.common.exceptions.WebDriverException 安装 Chromedriver:消息:“chromedriver.exe”可执行文件需要在 PATH 中 - Installing Chromedriver for Windows - selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH 出现错误:“chromedriver.exe”可执行文件需要在 Jupyter NoteBook 的 Mac 上的 PATH 中 - Getting Error: 'chromedriver.exe' executable needs to be in PATH on a Mac in Jupyter NoteBook 消息:“chromedriver.exe”可执行文件需要在 PATH 中。 请参阅 https://sites.google.com/a/chromium.org/chromedriver/home - Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 如何使用pyinstaller将chromedriver.exe与在selenium webdriver上运行的python脚本合并? - How to Merge chromedriver.exe with a python script that runs on selenium webdriver using pyinstaller? chromedriver.exe在PATH中,但是硒给我一个错误 - chromedriver.exe is in PATH, but selenium gives me an error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM