PhantomJS错误:消息:' phantomjs'可执行文件需要在PATH中

时间:2018-01-08 07:25:22

标签: python phantomjs



from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.PhantomJS()




脚本失败,出现以下错误



---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-3-6658ea2466a9> in <module>()
----> 1 driver = webdriver.PhantomJS()

/Users/yuyang/anaconda/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.pyc in __init__(self, executable_path, port, desired_capabilities, service_args, service_log_path)
     50             service_args=service_args,
     51             log_path=service_log_path)
---> 52         self.service.start()
     53 
     54         try:

/Users/yuyang/anaconda/lib/python2.7/site-packages/selenium/webdriver/common/service.pyc in start(self)
     79                 raise WebDriverException(
     80                     "'%s' executable needs to be in PATH. %s" % (
---> 81                         os.path.basename(self.path), self.start_error_message)
     82                 )
     83             elif err.errno == errno.EACCES:

WebDriverException: Message: 'phantomjs' executable needs to be in PATH. 
&#13;
&#13;
&#13;

操作系统:OSX

已经安装了phantomjs:

enter image description here

我的错误:

enter image description here

0 个答案:

没有答案