gpt4 book ai didi

python - 导入错误 : cannot import name 'TimedJSONWebSignatureSerializer' from 'itsdangerous'

转载 作者:行者123 更新时间:2023-12-05 08:45:08 35 4
gpt4 key购买 nike

我在 AWS EC2 实例中使用 itsdangerous python 包运行一个 flask 应用程序。

Traceback (most recent call last):
File "run.py", line 4, in <module>
app = create_app()
File "/home/ubuntu/RHS_US/application/portal/__init__.py", line 29, in create_app
from portal.users.routes import users
File "/home/ubuntu/RHS_US/application/portal/users/routes.py", line 7, in <module>
from portal.models import User
File "/home/ubuntu/RHS_US/application/portal/models.py", line 7, in <module>
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
ImportError: cannot import name 'TimedJSONWebSignatureSerializer' from 'itsdangerous' (/home/ubuntu/.local/lib/python3.7/site-packages/itsdangerous/__init__.py)

有什么解决办法吗?

最佳答案

首先确保重新安装和更新itsdangerous(因为不这样做很危险)

 pip install -U itsdangerous

那么你要做的就是

 from itsdangerous.url_safe import URLSafeTimedSerializer as Serializer

这很有效。

关于python - 导入错误 : cannot import name 'TimedJSONWebSignatureSerializer' from 'itsdangerous' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74039971/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com