1、軟件環境
python 2.7.1
pip已安裝
linux redhat 6.5企業版
2、安裝依賴
yum install libxml2 libxml2-dev libxslt-devel
3、安裝lxml
下載http://lxml.de/index.html#download
解壓用python setup.py install 安裝即可
4、下載pyspider源碼
https://github.com/binux/pyspider/tags
解壓用python setup.py install 安裝即可
5、安裝phantomjs2.1
前置安裝:
#yum -y install gcc gcc-c++ make flex bison gperf ruby \
openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
libpng-devel libjpeg-devel
然後下載安裝
#git clone git://github.com/ariya/phantomjs.git
#cd phantomjs
#git checkout 2.1.1
#git submodule init
#git submodule update
#python build.py
最後 建立軟鏈接 ln -s /../phantomjs/bin/phantomjs /usr/bin/
常見問題:
一般是依賴沒有安裝或者版本不兼容,像python安裝一般都這些問題。
ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)
解決:
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
easy_install pycurl
資料:
http://www.pyspider.cn/ pyspider中文網
http://docs.pyspider.org/en/latest/Quickstart/ 官方