gpt4 book ai didi

python - geckodriver 可执行文件需要在路径中

转载 作者:太空狗 更新时间:2023-10-29 17:51:44 26 4
gpt4 key购买 nike

我已阅读之前关于此主题的问题并尝试遵循建议,但我仍然遇到错误。在终端上,我跑了

export PATH=$PATH:/Users/Conger/Documents/geckodriver-0.8.0-OSX

我也试过

    export PATH=$PATH:/Users/Conger/Documents/geckodriver

当我运行以下 Python 代码时

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/Users/Conger/Documents/Firefox.app'

driver = webdriver.Firefox(capabilities=firefox_capabilities)

我仍然得到以下错误

Python - testwebscrap.py:8
Traceback (most recent call last):
File "/Users/Conger/Documents/Python/Crash_Course/testwebscrap.py", line 11, in <module>
driver = webdriver.Firefox(capabilities=firefox_capabilities)
File "/Users/Conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
self.service.start()
File "/Users/Conger/miniconda2/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 71, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x1006df6d0>> ignored
[Finished in 0.194s]

最佳答案

您可以通过以下方式降级您的 Selenium

pip install selenium==2.53.6

这解决了我的问题

关于python - geckodriver 可执行文件需要在路径中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40048940/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com