我在Ubuntu14.04中使用Selenium和Virtualenv在网页上搜索一些代码。制作virtualenv目录后,使用激活virtualenv 源bin / activate, 我安装了selenium,headless firefox,pyvirtualdisplay和firefox geckodriver。
我根据here安装了无头火狐。
我还发现有不同的python2.7文件夹 " /usr/lib/python2.7 /"和"〜/ ladder_selenium / lib / python2.7" (ladder_selenium是Virtualenv目录)
在我运行包含
的python代码之后from selenium import webdriver
,发生以下错误。
Traceback (most recent call last):
File "predict.py", line 12, in <module>
driver = webdriver.Firefox()
File "/home/heyjude/ladder_selenium/local/lib/python2.7/site-packages/selenium/webdriver/f
self.service.start()
File "/home/heyjude/ladder_selenium/local/lib/python2.7/site-packages/selenium/webdriver/c
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
你能告诉我要解决什么吗?
编辑以下评论:
(ladder_selenium) heyjude@ladder-selenium:~$ export DISPLAY=:99
(ladder_selenium) heyjude@ladder-selenium:~$ firefox
XPCOMGlueLoad error for file /opt/firefox/libmozgtk.so:
libgtk-3.so.0: cannot open shared object file: No such file or directory
Couldn't load XPCOM.