pyspider报cannot import name 'DispatcherMiddleware'求解

RainLee
  • 4
新手上路,请多包涵

CentOS7+Python3.6环境安装pyspider报ImportError: cannot import name 'DispatcherMiddleware'错误,有没有人知道怎么解决,详细错误:

Traceback (most recent call last):
  File "/usr/local/bin/pyspider", line 11, in <module>
    load_entry_point('pyspider==0.3.10', 'console_scripts', 'pyspider')()
  File "/usr/local/lib/python3.6/site-packages/pyspider/run.py", line 754, in main
    cli()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyspider/run.py", line 165, in cli
    ctx.invoke(all)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyspider/run.py", line 497, in all
    ctx.invoke(webui, **webui_config)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pyspider/run.py", line 384, in webui
    app.run(host=host, port=port)
  File "/usr/local/lib/python3.6/site-packages/pyspider/webui/app.py", line 64, in run
    from werkzeug.wsgi import DispatcherMiddleware
ImportError: cannot import name 'DispatcherMiddleware'

哪位大神给解答一下,谢谢。。

回复
阅读 5.3k
2 个回答

`1. pip uninstall werkzeug -y # 卸载

  1. pip install werkzeug==0.16.1 #安装0.16.1版本
  2. 或者
  3. python -m pip uninstall werkzeug -y # 卸载
  4. python -m pip install werkzeug==0.16.1 #安装0.16.1版本`
  5. 解决
RainLee
  • 4
新手上路,请多包涵

找到问题了werkzeug的版本为1.0.0,这个版本中没有DispatcherMiddleware方法,所以降低版本可以正常启动了,不过我另一台deepin系统的机器的werkzenug也是1.0.0却能正常启动。。。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
你知道吗?

宣传栏