我正在尝试通过此链接从python源代码安装python3.8.2,除了模块之外ssl
一切正常。
当我尝试如下命令时。
./configure --with-openssl=/usr --enable-optimizations
配置.log如下所示
configure:17204: checking for openssl/ssl.h in /usr
configure:17211: result: yes
configure:17227: checking whether compiling and linking against OpenSSL works
Trying link with OPENSSL_LDFLAGS=-L/usr/lib; OPENSSL_LIBS=-lssl -lcrypto; OPENSSL_INCLUDES=-
I/usr/include
configure:17249: gcc -pthread -o conftest -I/usr/include -L/usr/lib conftest.c -lssl -
lcrypto -lcrypt -lpthread -ldl -lutil -lm >&5
/tmp/ccnYKZ7g.o: In function `main':
conftest.c:(.text+0xa): undefined reference to `SSL_new'
collect2: error: ld returned 1 exit status
当我跑步时
使 -J 8
我收到类似以下内容的错误
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with
X509_VERIFY_PARAM_set1_host().
我按照此链接中提供的步骤解决了该问题
步骤1:
$ wget http://www.openssl.org/source/openssl-1.1.1g.tar.gz
步骤2:
$ tar -xf openssl-1.1.1g.tar.gz
步骤3:
$ cd openssl-1.1.1g
步骤4:
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
注意:
默认情况下,openssl 将安装在/usr/local/ssl(英语:openssl(下。如果您不想弄乱现有的SSL安装,请将其安装在其他目录中。
步骤5:
$ make
$ make test
$ make install
然后我导航到python安装的目录。 按照以下步骤操作
$ ./configure --with-openssl=/usr --enable-optimizations
$ make -j 8