“未编译 Python ssl 扩展。缺少 OpenSSL 库?” 使用 pyenv 安装 Python 时出错

cod*_*hia 3 python 18.04

使用 pyenv 安装 Python 时,出现以下错误:

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Run Code Online (Sandbox Code Playgroud)

我使用的是 Ubuntu 18.04 Bionic Beaver 我该如何解决这个问题?

小智 5

如果您尝试安装的 python 版本等于或低于 2.7.12,则它不支持 OpenSSL1.1.0,因此您需要替换libssl-devlibssl1.0-dev.

Ubuntu 18.04 是第一个切换到 OpenSSL1.1.0 的官方版本,这就是为什么您过去可能没有受到影响的原因。

参考:https : //github.com/pyenv/pyenv/issues/945

https://github.com/pyenv/pyenv/wiki/common-build-problems#error-the-python-ssl-extension-was-not-compiled-missing-the-openssl-lib