python3.6+版本安装pyspider报错解决方案)

淡淡的烟草味﹌ 2022-12-21 15:53 410阅读 0赞

python3.6+版本安装pyspider报错解决方案

  • 安装
  • 问题集合
    • async=True, get_object=False, no_input=False):
    • ImportError :pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl back
    • ValueError: Invalid configuration: - Deprecated option ‘domaincontroller’: use ‘http_authenticatorl
    • ImportError: cannot import name ‘DispatcherMiddleware’ from ‘werkzeug.wsgi’
  • 完成

安装

  1. # 也可能是pip3,根据具体情况而定
  2. pip install pyspider

pyspider官网

问题集合

async=True, get_object=False, no_input=False):

报错详情:

  1. async=True, get_object=False, no_input=False):
  2. ^
  3. SyntaxError: invalid syntax

原因分析 python3.6之后async已作为保留字段,不可作为自定义变量使用。

解决方式:
用vscode工具打开/usr/local/lib/python3.7/site-packages/pyspider 目录。全局搜索替换async变量为is_async

在这里插入图片描述

在这里插入图片描述
首先尝试重新安装解决

  1. pip uninstall pycurl
  2. export PYCURL_SSL_LIBRARY=openssl
  3. pip install pycurl

重新安装还是无法解决,在高版本的mac系统环境变量里是找不到openssl的头文件的

  1. pip uninstall pycurl# 卸载库
  2. export PYCURL_SSL_LIBRARY=openssl
  3. export LDFLAGS=-L/usr/local/opt/openssl/lib
  4. export CPPFLAGS=-I/usr/local/opt/openssl/include# openssl相关头文件路径
  5. pip install pycurl --compile --no-cache-dir# 重新编译安装

ValueError: Invalid configuration: - Deprecated option ‘domaincontroller’: use ‘http_authenticatorl

原因是因为WsgiDAV发布了版本 pre-release 3.x。

解决方法如下:
在安装包中找到pyspider的资源包,然后找到webui文件里面的webdav.py文件打开,修改第209行即可。

  1. # 'domaincontroller': NeedAuthController(app),
  2. 'http_authenticator':{
  3. 'HTTPAuthenticator': NeedAuthController(app),
  4. },

或者降低wsgidav版本

ImportError: cannot import name ‘DispatcherMiddleware’ from ‘werkzeug.wsgi’

在这里插入图片描述

  1. #卸载
  2. python -m pip uninstall werkzeug
  3. #安装指定版本
  4. python -m pip install werkzeug==0.16.0

完成

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,410人围观)

还没有评论,来说两句吧...

相关阅读

    相关 python3.6安装pyspider

    最近在学python爬虫,在安装pyspider库的时候,爆了一堆的错,查了好久才解决了,我把这些错误都集中记录在这个帖里,给大家做个参考。 首先是安装,用pip安装,用如下