1.安裝selenium
pip install selenium Collecting selenium Downloading selenium-3.4.1-py2.py3-none-any.whl (931kB) 100% |████████████████████████████████| 942kB 573kB/s Installing collected packages: selenium Successfully installed selenium-3.4.1
2.安裝phantomjs
下載地址:http://phantomjs.org/download.html
下載的版本是:phantomjs-2.1.1-linux-x86_64.tar.bz2
解壓下載好的文件,並把文件夾移動到/usr/local目錄下
sudo mv phantomjs-2.1.1-linux-x86_64 /usr/local/phantomjs
在/etc/profile下添加,之后source /etc/profile
export PHANTOMJS_HOME=/usr/local/phantomjs export PATH=$PATH:$PHANTOMJS_HOME/bin
測試是否安裝成功
phantomjs -v 2.1.1