AttributeError: module ‘lib‘ has no attribute ‘CRYPTOGRAPHY_OPENSSL_300_OR_GREATER‘问题解决

项目场景:

使用pyinstaller 打包exe
python版本 3.10.7
pyinstaller 版本 5.12.0

问题描述

打包过程中产生如下问题

15584 INFO: Loading module hook 'hook-cryptography.py' from 'C:\\Users\\Administrator\\Documents\\git-fork\\python-project\\venv\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
17069 WARNING: hook-cryptography: failed to determine whether cryptography is using OpenSSL >= 3.0.0
Traceback (most recent call last):
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-cryptography.py", line 62, in <module>
    uses_openssl3 = _check_cryptography_openssl3()
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\PyInstaller\isolated\_parent.py", line 420, in wrapped
    return call(function, *args, **kwargs)
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\PyInstaller\isolated\_parent.py", line 389, in call
    return isolated.call(function, *args, **kwargs)
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\PyInstaller\isolated\_parent.py", line 319, in call
    raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to _check_cryptography_openssl3() failed with:
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\PyInstaller\isolated\_child.py", line 63, in run_next_command
    output = function(*args, **kwargs)
  File "C:\Users\Administrator\Documents\git-fork\python-project\venv\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-cryptography.py", line 60, in _check_cryptography_openssl3
    return bool(backend._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)
AttributeError: module 'lib' has no attribute 'CRYPTOGRAPHY_OPENSSL_300_OR_GREATER'

原因分析:

具体问题是当前版本的cryptography有问题确实openssl库支持


解决方案:

参考链接
更换对应版本库就可以解决
pip install cryptography==38.0.4 解决问题

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值