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
即可
原文地址:https://blog.csdn.net/yilovexing
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。