ImportError: cannot import name DispatcherMiddleware错误

执行脚本错误如下:

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

          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

你可能感兴趣的:(python,flask,python,后端)