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/ 官方