加密包导入失败

2024-05-13 23:05:12 发布

您现在位置:Python中文网/ 问答频道 /正文

试图运行包含python-binanceOpenSSL模块的python3代码在cryptography包中的导入失败。以下是错误的部分堆栈跟踪:

  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'

Tags: inpytimelibpackagesusrdistline
1条回答
网友
1楼 · 发布于 2024-05-13 23:05:12

我的解决方案是升级加密包:

pip3 install upgrade cryptography

我还验证了所需系统包的安装:

sudo apt install build-essential libssl-dev libffi-dev python3-dev

相关问题 更多 >