MAC系统下pyspider插件安装报错

1.错误描述

我们在通过pip安装pyspider插件的时候会出现“Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7x/kht7960n33g7yb55y71rdndc0000gn/T/pip-install-Jnbs8n/pycurl/”的报错;展示如下:

//安装pyspider插件
zhangfujiedeMac-mini:~ zhangfujie$ pip install pyspider

//错误如下
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7x/kht7960n33g7yb55y71rdndc0000gn/T/pip-install-Jnbs8n/pycurl/

只需要输入以下代码就行:

zhangfujiedeMac-mini:~ zhangfujie$ export PYCURL_SSL_LIBRARY=openssl
 
zhangfujiedeMac-mini:~ zhangfujie$ pip install pycurl

结果如下:

zhangfujiedeMac-mini:~ zhangfujie$ export PYCURL_SSL_LIBRARY=openssl
zhangfujiedeMac-mini:~ zhangfujie$ 
zhangfujiedeMac-mini:~ zhangfujie$ pip install pycurl
Collecting pycurl
  Using cached https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz
Building wheels for collected packages: pycurl
  Running setup.py bdist_wheel for pycurl ... done
  Stored in directory: /Users/zhangfujie/Library/Caches/pip/wheels/d2/85/ae/ebf5ff0f1368869d082b4863df492bf54c661bf6306a2bdfde
Successfully built pycurl
Installing collected packages: pycurl
Successfully installed pycurl-7.43.0.2

然后再安装pyspider插件:

zhangfujiedeMac-mini:~ zhangfujie$ pip install pyspider

这样就安装成功了,可以直接在命令行下启动pyspider:

zhangfujiedeMac-mini:~ zhangfujie$ pyspider all
phantomjs fetcher running on port 25555
[I 181114 16:36:00 result_worker:49] result_worker starting...
[I 181114 16:36:00 processor:211] processor starting...
[I 181114 16:36:00 tornado_fetcher:638] fetcher starting...
[I 181114 16:36:00 scheduler:647] scheduler starting...
[I 181114 16:36:00 scheduler:782] scheduler.xmlrpc listening on 127.0.0.1:23333
[I 181114 16:36:00 scheduler:586] in 5m: new:0,success:0,retry:0,failed:0
[I 181114 16:36:00 app:76] webui running on 0.0.0.0:5000
^C[I 181114 16:36:17 app:84] webui exiting...
[I 181114 16:36:17 scheduler:663] scheduler exiting...
[I 181114 16:36:17 processor:229] processor exiting...
[I 181114 16:36:17 tornado_fetcher:671] fetcher exiting...
[I 181114 16:36:17 result_worker:66] result_worker exiting...

这时pyspider的web服务就在端口5000运行,直接在浏览器中输入:http://0.0.0.0:5000

即可进入pyspider的webUI管理界面,如下图:

2.错误描述

pyspider all运行pyspider的时候一直提示,《Error: Could not create web server listening on port 25555》如下:

pyspider all
Error: Could not create web server listening on port 25555
[I 190528 01:16:37 result_worker:49] result_worker starting...
[I 190528 01:16:38 tornado_fetcher:638] fetcher starting...
[I 190528 01:16:38 processor:211] processor starting...
[I 190528 01:16:38 scheduler:647] scheduler starting...
[I 190528 01:16:38 scheduler:782] scheduler.xmlrpc listening on 127.0.0.1:23333
[I 190528 01:16:38 scheduler:586] in 5m: new:0,success:0,retry:0,failed:0
[I 190528 01:16:38 app:76] webui running on 0.0.0.0:5000
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555

问题说明

这是因为2555端口被占用了,我们只需要查看是谁占用了,然后杀死进程就行了,如下:

zhangfujies-MacBook-Pro:~ zhangfujie$ netstat -atunlp
netstat: option requires an argument -- p
Usage:	netstat [-AaLlnW] [-f address_family | -p protocol]
	netstat [-gilns] [-f address_family]
	netstat -i | -I interface [-w wait] [-abdgRtS]
	netstat -s [-s] [-f address_family | -p protocol] [-w wait]
	netstat -i | -I interface -s [-f address_family | -p protocol]
	netstat -m [-m]
	netstat -r [-Aaln] [-f address_family]
	netstat -rs [-s]

zhangfujies-MacBook-Pro:~ zhangfujie$ tcp 0 0 0.0.0.0:25555 0.0.0.0:* LISTEN 18650/phantomjs 
-bash: tcp: command not found
zhangfujies-MacBook-Pro:~ zhangfujie$ lsof -i:25555
COMMAND     PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
phantomjs 10858 zhangfujie   11u  IPv4 0x76d0e590bfe84597      0t0  TCP *:25555 (LISTEN)
zhangfujies-MacBook-Pro:~ zhangfujie$ kill 10858
zhangfujies-MacBook-Pro:~ zhangfujie$

我们可以通过lsof -i:25555查看占用2555的进程,然后kill PID,最后重新pyspider all就行了!

结束语

欢迎各位大神补充!

欢迎大家加移动开发技术交流群,在这里大家可以一起讨论学习,这里有大佬,也有小菜鸟,没事还能斗斗图装装逼,如果需要换工作的还能相互推荐,期待大家的加入!

 

 

©️2020 CSDN 皮肤主题: 成长之路 设计师: Amelia_0503 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值