pyspider报cannot import name 'DispatcherMiddleware'求解

pyspider报cannot import name 'DispatcherMiddleware'求解

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'

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


回答:

`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. 解决


回答:

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

以上是 pyspider报cannot import name &#x27;DispatcherMiddleware&#x27;求解 的全部内容, 来源链接: utcz.com/a/160534.html

回到顶部