让chromedriver在UbuntuAW上工作的问题

2024-06-26 17:46:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用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'

我将感谢任何帮助!谢谢

enter image description here


Tags: inpyhomeubuntulibusrlinechrome