Python3 PySpider爬虫框架-安装

1 pip install pyspider  # Pip安装
2 pyspider all          # 命令行输入,启动PySpider
  • 安装使用常见错误:
    • 报错 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vXo1W3/pycurl;解决方法:一般会出现在 Windows 下,需要安装 PyCurl 库,PyCurl库安装:http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl
    • Python 3.7 无法启动PySpider:因为在Python3.7中添加了async和await两个关键字,所以不能作为函数的参数名,但是在PySpider的代码中有的参数名使用async;
      • 解决方法:降低Python版本,比如降到Python3.5,建议使用这种方法进行解决
      • 解决方法:修改PySpider代码,不使用async作为参数名(Python37Libsite-packagespyspider un.py和Python37Libsite-packagespyspiderfetcher ornado_fetcher.py;还有其他地方)
    • 不知道为什么始终无法访问http://localhost:5000/解决方法:查看PySpider安装文件中是否包含async作为参数名,比如WebUI文件夹中
    • 报错connect to scheduler rpc error: error(10061, '');解决方法:安装virtualenv
1 pip install pycurl‑7.43.0‑cp36‑cp36m‑win_amd64.whl    # 安装PyCurl,Windows 64 位,Python3.6
2 pyspider webui            # 查看webui是否可以运行
3 pip install virtualenv    # 安装virtualenv
    • 报错ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator' instead;解决方法:修改pyspider安装包中的webui文件夹中的webdav.py文件
1 'domaincontroller': NeedAuthController(app),
2 # 将上面的改为下面的
3 'http_authenticator':{
4         'HTTPAuthenticator':NeedAuthController(app),
5     },
 
 
原文地址:https://www.cnblogs.com/My-Sun-Shine/p/13551018.html