硒为什么找不到chrome驱动程序? [英] Why can't selenium find the chrome driver?

查看:126
本文介绍了硒为什么找不到chrome驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在跟踪有关使用Selenium和python为Twitter制作Web爬虫的教程,但遇到了此错误.

I am following a tutorial on using selenium and python to make a web scrapper for twitter, and I ran into this error.

File "C:\Python34\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Python34\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

我去了错误中指定的网站并下载了驱动程序.然后,通过转到系统属性">高级">环境变量">路径">新建"将其添加到path,并将exe文件添加到path.我再次尝试,但仍然出现错误.

I went to the website specified in the error and downloaded the driver. Then I added it to path by going to System Properties > Advanced > Environment Variables > Path > New and added the exe file to path. I tried again and i still got the error.

推荐答案

另一种方法是下载并解压缩 chromedriver 并将'chromedriver.exe'放入C:\ Python27 \ Scripts中,然后您无需提供驱动程序的路径,只需

Another way is download and uzip chromedriver and put 'chromedriver.exe' in C:\Python27\Scripts and then you need not to provide the path of driver, just

driver= webdriver.Chrome()

将起作用

这篇关于硒为什么找不到chrome驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆