如何解决ubuntu安装selenium时出现错误:Cannot fetch index base URL http://pypi.python.org/simple/
在ubuntu下安装selenium一直失败,快吐血了。如用命令:sudo pip install -U selenium,失败:
提示:
Downloading/unpacking selenium
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement selenium
No distributions at all found for selenium
Storing complete log in /home/yanner/.pip/pip.log
查了2天资料,总算找到了解决方法:
1、先确认是否安装了python;
[email protected]:~$ python -V
Python 2.7.3
2、确认是否安装了pip;
安装python-pip后,可通过 pip --version 查看一下已安装的版本及安装路径。
[email protected]:~$ pip --version
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)
3、用pip install
在官网https://pypi.org/project/selenium/ 找到包selenium-3.141.0.tar.gz的超链接:https://files.pythonhosted.org/packages/ed/9c/9030520bf6ff0b4c98988448a93c04fcbd5b13cd9520074d8ed53569ccfe/selenium-3.141.0.tar.gz
命令输入:sudo pip install 超链接,终于安装selenium成功:
Successfully installed selenium
Cleaning up…
进入Python交互模式,验证是否安装成功:
输入from selenium import webdriver,运行成功:
原文:https://www.cnblogs.com/yanner/archive/2019/06/14/11024230.html