从源代码构建 Python 3.7 遇到以下错误:
Building Python 3.7 from source runs into following error:
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, github/libressl-portable/portable/issues/381我从其他 stackoverflow 问题中尝试了很多解决方法,但它不起作用.我从源代码构建了最新的 OpenSSL 和 LibreSSL.OpenSSL 路径为:/usr/local/ssl",版本为 OpenSSL 1.0.2p.
I tried so many workarounds from other stackoverflow-questions, but it doesnt work. I build newest OpenSSL and LibreSSL from source. OpenSSL path is: "/usr/local/ssl" with version 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
My system: Ubuntu 12.04.5 LTS
有什么想法吗?
推荐答案我在 3 天后解决它只是因为 此博客. 使用 python 3.7.4 openssl 1.1.0 centOS 6.
I solved it after 3 days only because of this blog. with python 3.7.4 openssl 1.1.0 centOS 6.
总结如下:
首先,一些先决条件:
sudo apt-get install build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev如果使用 centos linux,请使用 yum 而不是 apt-get.
use yum instead of apt-get if using centos linux.
安装 ssl 1.0.2 或更高版本.
Install ssl 1.0.2 or higher.
cd /usr/src curl www.openssl/source/openssl-1.0.2o.tar.gz | tar xz cd openssl-1.0.2o ./config shared --prefix=/usr/local/ sudo make sudo make install我们需要将/usr/src/openssl-1.0.2o 传递到 Python 配置脚本中.
We will need to pass /usr/src/openssl-1.0.2o into the Python configure script.
mkdir lib cp ./*.{so,so.1.0.0,a,pc} ./lib现在继续安装 Python:
Now proceed with installing Python:
cd /usr/src sudo wget www.python/ftp/python/3.7.0/Python-3.7.0.tgz sudo tar xzf Python-3.7.0.tgz cd Python-3.7.0 ./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations sudo make sudo make altinstall要测试一下,运行 python3.7 并输入:
To test it out, run python3.7 and input:
import ssl ssl.OPENSSL_VERSION希望能帮到你!
更多推荐
构建 Python 3.7.1
发布评论