所以我试图使用Chromium在我的覆盆子pi上运行Selenium,由于某种原因我无法编译我的python文件。我一直收到以下错误:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver.exe'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 75, in start
os.path.basename(self.path), docs_msg)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
这是我正在尝试运行的python代码:
from selenium import webdriver
import os
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
driver.get("http://www.google.com")
driver.quit()
有什么想法吗?
更新
在chromedriver结束时删除'.exe'后,它现在产生以下错误:
Traceback (most recent call last):
File "test.py", line 4, in <module>
driver = webdriver.Chrome(os.path.expanduser('/usr/bin/chromedriver'))
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/chrome/service.py", line 68, in start
self.service_args, env=env, stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
答案 0 :(得分:3)
目前,Chrome驱动程序不再支持ARM处理器架构。
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=95322
答案 1 :(得分:2)
Ubuntu为armhf构建了chrome-chromedriver as .deb文件。
因此,在启动板上,您可以找到可供下载的chromium-chromedriver armhf builds。只需下载最新版本,由于它们没有依赖关系,您可以通过运行dpkg -i chromium-chromedriver_58.0.3029.96-0ubuntu0.14.04.1174_armhf.deb
进行安装。然后chromedriver将在/usr/lib/chromium-browser/chromedriver
。