如何使用 pyenv 安装 python 3.7.0?

How to install python 3.7.0 using pyenv?

我试着用命令安装 "pyenv install 3.7.0" 并得到如下错误

Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

BUILD FAILED (Ubuntu 14.04 using python-build 20180424)

我检查了 https://github.com/pyenv/pyenv/wiki/Common-build-problems 的解决方案并尝试了

CFLAGS=-I/usr/include/openssl \
LDFLAGS=-L/usr/lib64 \
pyenv install -v 3.7.0

我再次面临与

相同的错误
The Python ssl extension was not compiled. Missing the OpenSSL lib?

还尝试安装 python 低于 3.7 的版本,所有安装都没有错误。我在这里缺少任何依赖包或版本更新。 我有 openssl 版本

OpenSSL 1.0.1f 6 Jan 2014

你可以先通过命令安装openssl@1.1来安装同样的

    brew install 'openssl@1.1'

您可以安装 python3.7 使用:

    CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl@1.1)" pyenv install 3.7.0

或者如果您不想为 openssl 安装任何特定版本,那么您可以对 openssl 包使用以下命令。

    CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" pyenv install 3.7.0

Is there any dependent package or version update that I am missing here.

是的,不幸的是有。 Python 3.7.0 需要 OpenSSL 1.0.2。我找不到比开发邮件列表更好的来源。到目前为止,我一直没有成功让 Python 3.7.0 在 Ubuntu 14.04 上运行,因为安装正确版本的 OpenSSL 并且不冲突是一个技巧。

Python 3.7: Require OpenSSL >=1.0.2

https://mail.python.org/pipermail/python-dev/2018-January/151718.html