简体   繁体   中英

Can't get Python 3.7 on CentOS 7 to use installed OpenSSL 1.1.1

I've run searches all day without any luck or results. I have built a Centos 7 server and installed Python 3.7 along with OpenSSL 1.1.1.

However, when I run Python and perform the following:

import ssl
ssl.OPENSSL_VERSION

The output I get is OpenSSL 1.0.2k. When running openssl version at the prompt, I get OpenSSL 1.1.1.

Both OpenSSL and Python were compiled on the machine.

The correct OpenSSL is in the path. Also tried to compile Python with the configure --with-openssl=/usr/local (location of the correct openssl).

Thanks.

[Edit]
When I type

openssl version  
sudo openssl version  

I get different versions coming up. The sudo openssl version is the same that I get through Python. $PATH with and without sudo is the same

When you compile Python, you need to tell it which OpenSSL headers and libraries to use. Try this before running " ./configure " when building Python

export CFLAGS="$CFLAGS $(pkg-config --cflags openssl11)"
export LDFLAGS="$LDFLAGS $(pkg-config --libs openssl11)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM