pyspider部署以及遇到的问题(on centos7)
admin
2023-07-30 21:21:20
0

我是在自己的vps(centos7)上部署的,使用了virtualenv,使用的python版本为3.5.2
注意编译环境一定要装好。
关于centos7安装python3.5,启用virtualenv以及必须的编译环境,请看这里

部署

# 新建虚拟环境并进入
>>>virtualenv -p /usr/bin/python3 ~/envs/testenv
>>>source ~/envs/testenv/bin/activate

# 安装pycurl(安装pyspider时就会自动安装,但是自动安装的在我这儿出错)
>>>export PYCURL_SSL_LIBRARY=nss
>>>pip install pycurl --no-cache-dir

# 安装pyspider
>>>pip install pyspider

# 执行
pyspider

遇到的问题

pip install pyspider 执行后提示curl安装不上

是因为编译环境没有装好,yum安装libcurl-devel即可

安装好pyspider成功,运行pyspider命令时报错

RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment.  Either run this under Python 2 or consult http://click.pocoo.org/python3/ for mitigation steps.

是因为系统编码不对,按照http://click.pocoo.org/python3/上的说明

You are dealing with an environment where Python 3 thinks you are restricted to ASCII data. The solution to these problems is different depending on which locale your computer is running in.
If you are on a US machine, en_US.utf-8 is the encoding of choice. On some newer Linux systems, you could also try C.UTF-8 as the locale:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

执行

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8

运行pyspider命令时报错

libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)

卸载pycurl,按照之前的说明,重新安装。

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=[nss|openssl|ssl|gnutls]
pip install pycurl --no-cache-dir

[]中取决于你报错时link-time ssl backend后面括号的内容。保持相同即可
关于这部分讨论的stackoverflow的页面,http://stackoverflow.com/questions/21096436/ssl-backend-error-when-using-openssl

运行pyspider命令时提示ImportError: No module named \’_sqlite3\’

这是python3没有编译好。见这里

运行后效果

[W 160907 13:37:27 run:403] phantomjs not found, continue running without it.
[I 160907 13:37:29 result_worker:49] result_worker starting...
[I 160907 13:37:30 processor:208] processor starting...
[I 160907 13:37:30 scheduler:569] scheduler starting...
[I 160907 13:37:30 scheduler:508] in 5m: new:0,success:0,retry:0,failed:0
[I 160907 13:37:30 tornado_fetcher:508] fetcher starting...
/root/envs/hcomic/lib/python3.5/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.login is deprecated, use flask_login instead.
  .format(x=modname), ExtDeprecationWarning
[I 160907 13:37:30 scheduler:683] scheduler.xmlrpc listening on 127.0.0.1:23333
[W 160907 13:37:31 app:61] WebDav interface not enabled: ImportError(\"No module named \'wsgidav\'\",)
[I 160907 13:37:31 app:76] webui running on 0.0.0.0:5000

此时开放vps的5000端口,就可以通过浏览器访问pyspider的webui了

pyspider默认没有phantomjs和wsgidav。
需要自己配置开启。
默认使用sqlite数据库,会在执行pyspider命令的目录下生成data目录。

我的博客: ludaming.com

相关内容

热门资讯

Mobi、epub格式电子书如... 在wps里全局设置里有一个文件关联,打开,勾选电子书文件选项就可以了。
500 行 Python 代码... 语法分析器描述了一个句子的语法结构,用来帮助其他的应用进行推理。自然语言引入了很多意外的歧义,以我们...
定时清理删除C:\Progra... C:\Program Files (x86)下面很多scoped_dir开头的文件夹 写个批处理 定...
scoped_dir32_70... 一台虚拟机C盘总是莫名奇妙的空间用完,导致很多软件没法再运行。经过仔细检查发现是C:\Program...
65536是2的几次方 计算2... 65536是2的16次方:65536=2⁶ 65536是256的2次方:65536=256 6553...
小程序支付时提示:appid和... [Q]小程序支付时提示:appid和mch_id不匹配 [A]小程序和微信支付没有进行关联,访问“小...
pycparser 是一个用... `pycparser` 是一个用 Python 编写的 C 语言解析器。它可以用来解析 C 代码并构...
微信小程序使用slider实现... 众所周知哈,微信小程序里面的音频播放是没有进度条的,但最近有个项目呢,客户要求音频要有进度条控制,所...
Apache Doris 2.... 亲爱的社区小伙伴们,我们很高兴地向大家宣布,Apache Doris 2.0.0 版本已于...
python清除字符串里非数字... 本文实例讲述了python清除字符串里非数字字符的方法。分享给大家供大家参考。具体如下: impor...