我正在尝试通过遵循此link从python源安装python3.8.2,一切正常,期望ssl
模块。
当我尝试如下命令时。
./ configure --with-openssl = / usr --enable-optimizations
config.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
以及我跑步时
make -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().
我已按照此link中提供的步骤解决了此问题,>
步骤1:
$ wget http://www.openssl.org/source/openssl-1.1.1g.tar.gz
Step2:
$ tar -xf openssl-1.1.1g.tar.gz
Step3:
$ cd openssl-1.1.1g
Step4:
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
注意:
默认情况下,openssl将安装在/ usr / local / ssl下。如果您不想弄乱现有的SSL安装,则将其安装在其他目录中。
Step5:
$ make $ make test $ make install
然后我导航至python安装目录。遵循以下步骤
$ ./configure --with-openssl=/usr --enable-optimizations
$ make -j 8