【问题标题】:Can't update Python's OpenSSL无法更新 Python 的 OpenSSL
【发布时间】:2021-10-10 14:54:12
【问题描述】:

对于我的一个项目,我需要最新版本的 SSL 证书。

这就是我所拥有的:

python3 --version

Python 3.8.6

openssl version

OpenSSL 1.1.1f  31 Mar 2020

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.0.2g  1 Mar 2016

python3 -m OpenSSL.debug

pyOpenSSL: 21.0.0
cryptography: 35.0.0
cffi: 1.14.4
cryptography's compiled against OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
cryptography's linked OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016
Python executable: /usr/bin/python3
Python version: 3.8.6 (default, Oct  6 2020, 04:02:53)
[GCC 5.4.0 20160609]
Platform: linux
sys.path: ['/opt/programs', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/local/lib/python3.8/dist-packages/pip-21.0.1-py3.8.egg', '/usr/lib/python3/dist-packages']

我认为这就是问题

Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016

所以我创建了一个新的虚拟环境和 pyOpenSSL 并再次检查 SSL

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.0.2g  1 Mar 2016

python3 -m OpenSSL.debug

pyOpenSSL: 21.0.0
cryptography: 35.0.0
cffi: 1.14.6
cryptography's compiled against OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
cryptography's linked OpenSSL: OpenSSL 1.1.1l  24 Aug 2021
Python's OpenSSL: OpenSSL 1.0.2g  1 Mar 2016
Python executable: /opt/parsers/env4/bin/python3
Python version: 3.8.6 (default, Oct  6 2020, 04:02:53)
[GCC 5.4.0 20160609]
Platform: linux
sys.path: ['/opt/programs', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/parsers/env4/lib/python3.8/site-packages']

我也看到了同样的问题: Python 的 OpenSSL:OpenSSL 1.0.2g 2016 年 3 月 1 日

如何更新 Python 的 OpenSSL?

【问题讨论】:

  • 我的 python (3.8.10) 给出:`python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)' -> OpenSSL 1.1.1f 31 Mar 2020' 也许你应该升级你的 python 版本。
  • 是的,我将安装 python 3.9,其上的 Python 的 SSL 是“OpenSSL 1.1.1f 31 Mar 2020”,但现在我无法使用 python 3.9 创建新环境

标签: python python-3.x linux ssl openssl


【解决方案1】:

我迫不及待地想知道答案。并且仍然没有解决 Python 更新问题。

但我为我的项目找到了解决方案。

我在本地安装了新版本的 Python (3.9.7),并使用它在我的项目中创建了一个新的虚拟环境。

然后我使用新的 venv 检查了 Python 的 SSL 证书:

python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'

OpenSSL 1.1.1f 31 Mar 2020

这就是我需要的

然后我将所有依赖项安装在一个新的 venv 中。我将旧的 venv 从“env”重命名为“env2”并暂时保留以防万一。我将新的 venv 重命名为“env”并激活它。

这就是我的项目开始工作的方式。

【讨论】:

    猜你喜欢
    • 2013-09-16
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-03
    • 2018-02-06
    • 1970-01-01
    相关资源
    最近更新 更多