1. 安装selenium
pip install selenium
2. 安装phantomjs
如果你是Ubuntu12.04,默认安装的版本是1.4.这个会出错。
需要安装1.9.7
cd /usr/local/share sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2 sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs