yanner

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在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:

在官网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,运行成功:

 

posted on 2019-06-14 16:56  yanner  阅读(852)  评论(0编辑  收藏  举报