我试图在使用selenium和phantomjs webdriver的linux服务器上运行python脚本;但是,我一直收到以下错误消息:
selenium.common.exceptions.WebDriverException: Message: Service /home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs unexpectedly exited. Status code was: 127
下面是一个失败并生成此错误的简单测试脚本:
import selenium
from selenium import webdriver
driver = webdriver.PhantomJS(executable_path='/home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs')
调用路径上的文件,返回:
file /home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
/home/ubuntu/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=d0f2a21ff9e0b82113a2095e7cbca7dceaba88fb, stripped
有人知道我怎样才能启动和运行这个脚本吗?我已经阅读了一些看起来类似的stackoverflow问题,并尝试应用建议的解决方案,例如通过npm重新安装phantom和使用sudo执行脚本,但是没有成功。如果我能提供更多的信息,请告诉我。
这解决了我的问题。
相关问题 更多 >
编程相关推荐