openstack报错CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead的解决办法

完整报错信息如下

/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
from cryptography.utils import int_from_bytes

报错原因:

弃用警告是由库如何从字节加载整数值引起的。这与 fastapi 无关,但是您正在使用的库中的问题。但是,该问题已在(2021-04-29) 。

解决办法:

尝试将加密包升级到最新的可用版本

python3 -m pip install -U cryptography

再去查看报错就消失了。

原文参考:

python - CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead - Stack Overflow

发表评论

后才能评论