使用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'
我将不胜感激!谢谢。
答案 0 :(得分:0)
尝试chromedriver\ 4
或从文件名中删除空格。