ImportErrorcannotimportnameDispatcherMiddleware错误

coding

执行脚本错误如下:

root@ubuntu123:/opt/miniNomad# python mini_jt.py
Traceback (most recent call last):
  File "mini_jt.py", line 8, in <module>
    from flask_spyne import Spyne
  File "/usr/local/lib/python2.7/dist-packages/flask_spyne/__init__.py", line 1, in <module>
    from flask_spyne import Spyne, SpyneService, SpyneController
  File "/usr/local/lib/python2.7/dist-packages/flask_spyne/flask_spyne.py", line 3, in <module>

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

 

原因:

1、没有安装werkzeug

2、werkzeug的版本为1.0.0,这个版本中没有DispatcherMiddleware方法

解决办法:

卸载werkzeug,重新安装低版本的werkzeug

#卸载

python -m pip uninstall werkzeug

#安装指定版本

python -m pip install werkzeug==0.16.0

以上是 ImportErrorcannotimportnameDispatcherMiddleware错误 的全部内容, 来源链接: utcz.com/z/509853.html

回到顶部