如何解决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;
yanner@yanner-virtualbox:~$ python -v
python 2.7.3
2、确认是否安装了pip;
安装python-pip后,可通过 pip --version 查看一下已安装的版本及安装路径。
yanner@yanner-virtualbox:~$ pip --version
pip 1.0 from /usr/lib/python2.7/dist-packages (python 2.7)
3、用pip install <path>命令来安装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,运行成功:
上一篇: Linux系统入门-Bash初识