我在我的 ubuntu 机器上使用 python 3.6,并在进行一些测试时遇到此错误:
CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.
...
from OpenSSL import crypto, SSL
default: File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1550, in <module>
default: class X509StoreFlags(object):
default: File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1570, in X509StoreFlags
default: CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
default: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'
Run Code Online (Sandbox Code Playgroud)
对错误进行了研究。所以我安装了 python 3.9,然后更新替代方案以将 python 3.9 指定为要使用的主要 python。然后我重新安装并升级 OpenSSL 和加密技术。
sudo pip3 install …Run Code Online (Sandbox Code Playgroud) openssl ×1