【问题标题】:Python Selenium chromedriver OSError: [Errno 8] Exec format errorPython Selenium chromedriver OSError: [Errno 8] Exec 格式错误
【发布时间】:2016-07-08 13:14:31
【问题描述】:

我正在尝试在我的 python (2.7) 脚本中设置与 Selenium 的 chrome 会话,如下所示:

from selenium import webdriver
driver=webdriver.Chrome()

但我收到以下错误:

Traceback (most recent call last):
File "soup_test.py", line 30, in <module>
driver=webdriver.Chrome()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 61, in __init__
self.service.start()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 62, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error

通过其他问题搜索,一个常见问题似乎是 chromedriver 不在路径上,但我检查了它。我什至尝试明确指定路径:

driver=webdriver.Chrome("/path/to/chromedriver")

结果相同。有谁知道可能是什么问题?非常感谢您的帮助!

【问题讨论】:

  • 我也想知道..

标签: python macos selenium


【解决方案1】:

我最终通过卸载 chromedriver 的所有实例(我在不同位置有多个)然后用自制软件再次安装它解决了这个问题:brew install chromedriver

【讨论】:

  • 在osx上,一旦你做了brew install chromedriver,你应该可以指向executable_path='/usr/local/bin/chromedriver
猜你喜欢
  • 2016-12-14
  • 1970-01-01
  • 2016-04-15
  • 2016-12-31
  • 2020-02-23
  • 2019-08-14
  • 2019-02-28
  • 2019-05-24
  • 2015-02-20
相关资源
最近更新 更多