从源代码构建 Python 3.7 遇到以下错误:
Failed to build these modules:
_hashlib _ssl
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
我尝试了很多来自其他 stackoverflow 问题的解决方法,但没有用。我从源代码构建最新的 OpenSSL 和 LibreSSL。 OpenSSL 路径是:“/usr/local/ssl”,版本为 OpenSSL 1.0.2p。
./configure --with-openssl=/usr/local/ssl/
(./configure CPPFLAGS="-I/usr/local/ssl/include" LDFLAGS="-L/usr/local/ssl/lib")
make
make altinstall
我的系统:Ubuntu 12.04.5 LTS
有任何想法吗?
原文由 mcatis 发布,翻译遵循 CC BY-SA 4.0 许可协议
仅仅因为 这个博客,我在 3 天后解决了它。 使用 python 3.7.4 openssl 1.1.0 centOS 6。
这是摘要:
首先,一些先决条件:
如果使用 centos linux,请使用 yum 而不是 apt-get。
安装 ssl 1.0.2 或更高版本。
我们需要将 /usr/src/openssl-1.0.2o 传递到 Python 配置脚本中。
现在继续安装 Python:
要测试它,请运行 python3.7 并输入:
希望能帮助到你!