Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 让chromedriver在Ubuntu AWS上工作的问题_Python_Amazon Web Services_Ubuntu_Amazon Ec2_Selenium Chromedriver - Fatal编程技术网

Python 让chromedriver在Ubuntu AWS上工作的问题

Python 让chromedriver在Ubuntu AWS上工作的问题,python,amazon-web-services,ubuntu,amazon-ec2,selenium-chromedriver,Python,Amazon Web Services,Ubuntu,Amazon Ec2,Selenium Chromedriver,我在使用Ubuntu让chromedriver在AWS EC2实例上运行时遇到问题。如下图所示,我使用FileZilla将chromedriver放入我的远程ubuntu站点,与python脚本位于同一文件夹中。然后,我修改了python代码,从ubuntu服务器访问chromedriver,而不是从本地路径: options = Options() driverLocation = webdriver.Chrome(chrome_options=options, executable_pat

我在使用Ubuntu让chromedriver在AWS EC2实例上运行时遇到问题。如下图所示,我使用FileZilla将chromedriver放入我的远程ubuntu站点,与python脚本位于同一文件夹中。然后,我修改了python代码,从ubuntu服务器访问chromedriver,而不是从本地路径:

options = Options()
driverLocation = webdriver.Chrome(chrome_options=options, 
executable_path=r'/home/ubuntu/bandsintown/chromedriver 4')
driverLocation.quit()
但是,我得到了以下错误:

   Traceback (most recent call last):
  File "BandsInTown_Scraper_SF.py", line 33, in <module>
    driverLocation = webdriver.Chrome(chrome_options=options, executable_path=r'/home/ubuntu/bandsintown/chromedriver 4')
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/ubuntu/bandsintown/chromedriver 4'
回溯(最近一次呼叫最后一次):
文件“BandsInTown\u Scraper\u SF.py”,第33行,in
driverLocation=webdriver.Chrome(Chrome\u options=options,executable\u path=r'/home/ubuntu/bandsintown/chromedriver 4')
文件“/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py”,第73行,在__
self.service.start()
文件“/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py”,第76行,开始
标准偏差=管道)
文件“/usr/lib/python3.6/subprocess.py”,第729行,在__
恢复信号,启动新会话)
文件“/usr/lib/python3.6/subprocess.py”,第1364行,在执行子进程中
引发子项异常类型(错误号、错误消息、错误文件名)
OSError:[Errno 8]Exec格式错误:'/home/ubuntu/bandsintown/chromedriver 4'
我将感谢任何帮助!谢谢


尝试
chromedriver\4
或删除文件名中的空格。

仍然不走运。将chromedriver重新命名为chromedriver 4(没有空格)仍然会出现错误:OSError:[Errno 8]Exec格式错误:并且,chromedriver\4仍然会出现错误:可执行文件需要在路径中。您是否在源代码中更改了文件名?是的,我尝试了:driverLocation=webdriver.Chrome(Chrome\u options=options,executable\u PATH=r'/home/ubuntu/bandsintown/chromedriver\4')而且,driverLocation=webdriver.Chrome(Chrome\u options=options,executable\u path=r'/home/ubuntu/bandsintown/chromedriver4')试图将webdriver添加到它所说的路径中?