funnel77
funnel77

Reputation: 41

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

Upvotes: 3

Views: 1075

Answers (1)

gjvc
gjvc

Reputation: 140

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)"

Upvotes: 0

Related Questions