Python Selenium chromedriver OSError : [Errno 8] Exec format error

标签 python macos selenium

我正在尝试在我的 python (2.7) 脚本中使用 Selenium 设置一个 chrome session ,如下所示:

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")

同样的结果。任何人都知道可能是什么问题?非常感谢您的帮助!

最佳答案

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

关于Python Selenium chromedriver OSError : [Errno 8] Exec format error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36141032/

相关文章:

python - 无法删除通过 python os.mkdir 创建的文件夹

objective-c - NSWindow 可恢复并不总是有效

c - 在 OSX 上分发二进制库

javascript - 使用带有 BeautifulSoup 的 React JS 渲染的抓取元素

python - 在 Python 子进程上使用小于号 (<)

java - Eclipse/PyCharm 中的 jython 设置

MYSQL安装问题

c# - Selenium WebDriver 测试登录验证/身份验证

python - 如何在 selenium,python 中处理 TimeoutException

Python 3.6 类型检查 : numpy arrays and use defined classes