我試圖運行此腳本:PhantomJS硒錯誤:消息:「phantomjs」可執行文件需要在PATH
https://github.com/Chillee/coursera-dl-all
然而,該腳本在行session = webdriver.PhantomJS()
失敗,出現以下錯誤
Traceback (most recent call last):
File "dl_all.py", line 236, in <module>
session = webdriver.PhantomJS()
File "/home/shaan/.local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
self.service.start()
File "/home/shaan/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x7f6f632864d0>> ignored
如何將phantomjs添加到我的PATH中?我運行Ubuntu 16.04並通過npm install selenium
安裝硒。
是否安裝了phantomjs? –
應該是。有什麼方法我可以仔細檢查? – quantumbutterfly
做'哪個phantomjs'。如果不在那裏,只需將其移動到/ usr/bin或PATH中的任何其他位置 – pguardiario