为了账号安全,请及时绑定邮箱和手机立即绑定

'phantomjs' 可执行文件可能有错误的权限

'phantomjs' 可执行文件可能有错误的权限

jeck猫 2021-06-14 08:15:45
此脚本在 Google Cloud Service 上运行良好。但是我在 Amazon Web Service EC2 上遇到错误:(操作系统:linux 64bit)selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable may have wrong permissions.完整代码: /usr/local/lib/python3.7/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead  warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless 'Traceback (most recent call last):  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 76, in start    stdin=PIPE)  File "/usr/lib64/python3.7/subprocess.py", line 756, in __init__    restore_signals, start_new_session)  File "/usr/lib64/python3.7/subprocess.py", line 1499, in _execute_child    raise child_exception_type(errno_num, err_msg, err_filename)PermissionError: [Errno 13] Permission denied: '/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "turkish.py", line 114, in <module>    bot = TransBot()  File "turkish.py", line 13, in __init__    self.driver = webdriver.PhantomJS(executable_path='/usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs')  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 56, in __init__    self.service.start()  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/common/service.py", line 88, in start    os.path.basename(self.path), self.start_error_message)selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable may have wrong permissions.我尝试移动 '/usr/local/bin' 和 '/usr/local/share' phantomjs 文件。同样的错误。你有什么建议?对不起我的英语。
查看完整描述

2 回答

?
幕布斯7119047

TA贡献1794条经验 获得超8个赞

更改权限,使其可执行。

$ chmod a+x phantomsjs


查看完整回答
反对 回复 2021-06-16
  • 2 回答
  • 0 关注
  • 464 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号