'chromedriver' executable needs to be in PATH解决办法

Python 用selenium打开浏览器,如果没有Chromedrive就会报这个错

解决方案:

1. 下载Chromedrive

chromedriver的下载地址:
http://chromedriver.storage.googleapis.com/index.html

这里要注意:chromedriver的版本有很多,一定要下载与你电脑上chrome浏览器版本相对应的版本。对应关系可以参照文章
https://blog.csdn.net/huilan_same/article/details/51896672 ,这篇文章作者整理的是比较新的版本。

2. 将Chromedrive.exe复制到Chrome根目录下

下载之后是zip压缩包,里面只有一个Chromedrive.exe,不用点,直接复制到C:\Program Files (x86)\Google\Chrome\Application,Chrome浏览器也只能安装到这个目录。
在这里插入图片描述

3.添加到环境变量

打开开始菜单->我的电脑(或计算机)->系统属性->高级系统设置->环境变量,编辑用户变量里的path,
在最后面添加;C:\Program Files (x86)\Google\Chrome\Application
或者在最前面添加C:\Program Files (x86)\Google\Chrome\Application;
总之变量之间用分号隔开,修改完之后点击确定按钮保存配置。

完美解决

猜你喜欢

转载自blog.csdn.net/L397179459/article/details/88897401