问题1:ImportError: cannot import name 'url_quote' from 'werkzeug.urls'
其根本原因是Werkzeug 3.0.0
删除了之前已弃用的代码: https: //werkzeug.palletsprojects.com/en/3.0.x/changes/#version-3-0-0
请更新您的 Flask 版本,Flask 2.2.2
不受支持:https ://github.com/pallets/flask/releases
无论如何,如果你坚持使用已弃用的版本Flask
,或者如果你的代码直接使用url_quote
,那么你可以切换到内置版本,你需要自己固定 Werkzeug urllib
:
问题2:
问题3:打开项目的位置错了,应该从pythonproject打开,而不是上一层目录打开
问题4:安装库有时候不成功,可以确认下是不是库的版本与python版本不兼容
问题5、pip3 install --upgrade urllib3 这个库与你的python版本不兼容
问题6.E DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
from datetime import datetime, timezone
def aware_utcnow():
return datetime.now(timezone.utc)
def aware_utcfromtimestamp(timestamp):
return datetime.fromtimestamp(timestamp, timezone.utc)
def naive_utcnow():
return aware_utcnow().replace(tzinfo=None)
def naive_utcfromtimestamp(timestamp):
return aware_utcfromtimestamp(timestamp).replace(tzinfo=None)
print(aware_utcnow())
print(aware_utcfromtimestamp(0))
print(naive_utcnow())
print(naive_utcfromtimestamp(0))