1.搭建环境:
python版本:3.5.1 -宝塔 python管理工具安装
系统环境:centos7.6
2.安装pyspider
pip install pyspider
3.安装phantomjs
官网下载:http://phantomjs.org/download.html
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
解压:
yum -y install unbzip2
bzip2 -d phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -xf phantomjs-2.1.1-linux-x86_64.tar
mv phantomjs-2.1.1-linux-x86_64 phantomjs
ln -sv /usr/local/phantomjs/bin/phantomjs /usr/bin/phantomjs
4.启动pyspider
5.报错及解决办法
5.1 启动python中的pycurl模块出现如下问题:
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
需要注意的是之前用pip安装的,然后卸载掉以后,一定要用easy_install安装才可以导入成功。
5.2. 启动pyspider报错
raise ValueError("Invalid configuration:\n - " + "\n - ".join(errors))
ValueError: Invalid configuration:
Deprecated option ‘domaincontroller’: use ‘domain_controller’ instead.
解决办法:
这是WsgiDAV发布了版本 pre-release 3.x导致的,所以只要把版本降下来就好了。
将wsgidav替换为2.4.1
•# python -m pip install wsgidav==2.4.1