安装 chromedriver 依赖
背景使用selenium驱动Chrome, 但是执行的时候报错,
这是因为缺少 chromedriver依赖 环境: centos 7 64 操作驱动Chrome程序 from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
chrome_options.binary_location = './chrome'
driver = webdriver.Chrome(chrome_options=chrome_options,executable_path="./chromedriver")
driver.get("http://www.duo.com")
查看 chromedriver 需要的依赖: ./chromedriver --version
显示 ./chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
列出软件包libgconf-2.so.4提供的文件 yum provides */libgconf-2.so.4 安装 sudo yum install GConf2
如果 其他方法有时候会发现按照上面的方法进行操作的时候,会发现缺少的包还依赖其他缺少的包。 参考: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |