【问题标题】:Import certificate_transparency in Python在 Python 中导入证书透明度
【发布时间】:2018-11-03 11:55:35
【问题描述】:

我之前运行良好的应用程序出现错误:

File "/usr/lib/python2.7/site-packages/cryptography/x509/__init__.py", line 7, in <module>
    from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency

密码库的版本是 2.2.2,我提出文件 certificate_transparency.py 存在于所需的文件夹中。上述问题的根源可能是什么?

pip 10.0.1 from /home/serj/.local/lib/python2.7/site-packages/pip (python 2.7)

【问题讨论】:

    标签: python python-cryptography


    【解决方案1】:

    我有同样的问题,密码学有问题。试试

    sudo pip install --upgrade cryptography
    

    【讨论】:

      【解决方案2】:

      我找到了一个简单的解决方案。但是需要修改源代码。

      1. 添加certificate_transparency文件的路径:
      import sys, os
      sys.path.append(os.path.append('/usr/lib/python2.7/site-packages/cryptography/x509'))
      
      1. 更改/usr/lib/python2.7/site-packages/cryptography/x509/__init__.py中的代码

      然后替换这个(旧行): from cryptography.x509 import certificate_transparency

      用这个(新行): import certificate_transparency

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-03-09
        • 2021-01-20
        • 1970-01-01
        • 2019-10-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-22
        • 1970-01-01
        相关资源
        最近更新 更多