pip 是 Python 中超级好用的包管理工具,但是 pip 会不定时更新
WARNING: You are using pip version 19.3.1; however,version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
提示已经很明显了,我们使用 upgrade 更新我们的 pip
pip install --upgrade pip
但是更新完以后就郁闷了,之前的项目启动不起来了。。。
Traceback (most recent call last):
File "/Users/zhangyi/Documents/crm/manage.py",line 7,in <module>
from app.urls import blueprint
File "/Users/zhangyi/Documents/crm/app/urls.py",line 5,in <module>
from flask_restplus import Api
File "/Users/zhangyi/.virtualenvs/crm_user_service/lib/python3.8/site-packages/flask_restplus/__init__.py",line 4,in <module>
from . import fields,reqparse,apidoc,inputs,cors
File "/Users/zhangyi/.virtualenvs/crm_user_service/lib/python3.8/site-packages/flask_restplus/fields.py",line 17,in <module>
from werkzeug import cached_property
ImportError: cannot import name 'cached_property' from 'werkzeug' (/Users/zhangyi/.virtualenvs/crm_user_service/lib/python3.8/site-packages/werkzeug/__init__.py)
根据报错,我们知道是因为导入 werkzeug 包时报错。。。
作为一个“面向谷歌编程”的程序员,查询后得知这是因为 werkzeug 新版本里需要显式导入该模块
所以我没找到它的包路径
/Users/zhangyi/.virtualenvs/crm_user_service/lib/python3.8/site-packages/werkzeug/__init__.py
添加一行
from werkzeug.utils import cached_property
即可 (编辑:北几岛)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|