安装selenium,驱动geckodriver,及出现的问题

cmd输入安装selenium指令:

pip install selenium

1.报错 Could not find a version that satisfies the requirement selenium (from versions: )
No matching distribution found for selenium

说找不到合适的版本

解决:找了很多资料,其中有个说切换网络的,我试了一下,果然有用。我连接的移动校园网,后来用手机开了4G热点,连接后再下载,就没有这个报错了。

但是:出现了新的错误:

2.报错:Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'C:\\Program Files\\Python37\\Lib\\site-packages\\selenium'
Consider using the `--user` option or check the permissions.

解决:权限问题,把安装指令改为:

pip install --user selenium

 

成功安装,警告被我忽略了。

安装驱动geckodriver(驱动用于打开浏览器)

下载地址:https://github.com/mozilla/geckodriver/releases

解压到python文件根目录。

猜你喜欢

转载自www.cnblogs.com/cttcarrotsgarden/p/10740383.html
今日推荐