Ubuntu python安装与配置selenium

安装selenium

指定pip安装selenium
1.linux,通过anaconda所在文件夹查找pip文档所在路径(windows则查找pip.exe所在路径),之后用带路径的pip 安装selenium

# ubuntu
sudo /home/horcham/anaconda2/bin/pip install selenium
# windows
/home/horcham/anaconda2/bin/pip install selenium

配置webdriver.Chrome

ubuntu安装chromedriver:

sudo brew install chromedriver

出现这一行结果

horcham@horcham-Inspiron-3542:~$ brew install chromedriver
Updating Homebrew...
==> Downloading https://chromedriver.storage.googleapis.com/2.27/chromedriver_li
Already downloaded: /home/horcham/.cache/Homebrew/chromedriver-2.27.zip
/home/horcham/.linuxbrew/Cellar/chromedriver/2.27: 3 files, 7.1M, built in 0 seconds

其中,安装包所在位置为/home/horcham/.cache/Homebrew/chromedriver-2.27.zip,将其移动到并解压,可以得到chromedriver文件。并通过以下指令移动到usr/bin/中

sudo cp chromedriver usr/bin/

最后更新chromedriver权限

sudo chmod a+x chromedriver

参考文献
[1] http://blog.csdn.net/vincentluo91/article/details/52947214
[2] http://www.linuxdiyf.com/linux/25779.html

你可能感兴趣的:(python)