报错

pip install pyspider失败的解决办法 Python 第1张


下载pycurl库

地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl

选择对应的python版本

pip install pyspider失败的解决办法 Python 第2张


SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

安装pycurl库

pip install 文件名

pip install pyspider失败的解决办法 Python 第3张


安装pyspider库

换源安装pyspiderpip install pyspider -i https://pypi.doubanio.com/simple

pip install pyspider失败的解决办法 Python 第4张

安装成功

pip install pyspider失败的解决办法 Python 第5张


此时运行pyspider还会报错

  • 因为 pyspider 的作者在参数中用了async关键字
  • Python 3.5中引入了async和await,它们在Python 3.7中成为关键字

pip install pyspider失败的解决办法 Python 第6张


修改pyspider里的async关键字

到python安装目录下,找到这三个文件,Ctrl + H ,将里面的 async 替换为任何非关键字以外的参数,比如 async123,然后保存

  • Lib\site-packages\pyspider\run.py
  • Lib\site-packages\pyspider\webui\app.py
  • Lib\site-packages\pyspider\fetcher\tornado_fetcher.py(这个文件里的async记得区分大小写)

如果忘记安装目录,可以用pip --version查看

pip install pyspider失败的解决办法 Python 第7张


最后修改一个文件,解决这个问题:Deprecated option 'domaincontroller': use 'http_authenticator.domain_controller' instead.

  • Lib\site-packages\pyspider\webui\webdav.py
将209行的
'domaincontroller': NeedAuthController(app),

修改为
'http_authenticator': {
        'HTTPAuthenticator': NeedAuthController(app),
    },

修改前

pip install pyspider失败的解决办法 Python 第8张

修改后

pip install pyspider失败的解决办法 Python 第9张


大功告成

pip install pyspider失败的解决办法 Python 第10张

浏览器打开localhost:5000

pip install pyspider失败的解决办法 Python 第11张




扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄