在python-binance
软件包中导入时,尝试运行包含OpenSSL
和cryptography
模块的Python 3代码失败。这是错误的部分堆栈跟踪:
File "/usr/lib/python3/dist-packages/cryptography/x509/base.py", line 15, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "/usr/lib/python3/dist-packages/cryptography/x509/extensions.py", line 19, in <module>
from cryptography.hazmat.primitives import constant_time, serialization
File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/constant_time.py", line 9, in <module>
from cryptography.hazmat.bindings._constant_time import lib
ModuleNotFoundError: No module named 'cryptography.hazmat.bindings._constant_time'
答案 0 :(得分:0)
对我来说,解决方案是升级加密软件包:
pip3 install --upgrade cryptography
我还验证了所需系统软件包的安装:
sudo apt install build-essential libssl-dev libffi-dev python3-dev