Requirements: >=Python 3.6, newest openssl
- Download python3 source from offical website
- Download openssl source from offical website
sudo yum install zlib-devel perl-Test-Simple
tar zxvf openssl-*.tar.gz
cd cd openssl-*
./config --prefix=/opt/openssl --openssldir=/opt/openssl no-ssl2
make
make test
If Failed test 'running ssl_test 12-ct.cnf' occured, ignore it (fix in next patch)
sudo make install
1.Find out the name of openssl lib directory (lib64/lib)
export PATH=/opt/openssl/bin:$PATH
export LD_LIBRARY_PATH=/opt/openssl/lib64
export LC_ALL="en_US.UTF-8"
export LDFLAGS="-L /opt/openssl/lib64 -Wl,-rpath,/opt/openssl/lib64"
. ~/.bash_profile
which openssl
/opt/openssl/bin/openssl
[leele3@] openssl version
OpenSSL 3.0.3 3 May 2022 (Library: OpenSSL 3.0.3 3 May 2022)
tar -zxvf Python-3.?.?.tar.xz
vi ./Python-3*/Modules/Setup.dist
_socket socketmodule.c
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/opt/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
cd {Python script path}
./configure
make
sudo make altinstall or install
python3.6
import ssl
This normally happened when multiple openssl version installed Need to customize Python3 setup script
- Modify python3 setup.py following this link
- Configure Python3 installation script again
cd {python script directory}
./configure --with-openssl=/opt/ (no need openssl directory)
make
sudo make altinstall or install
1.download release from github page
2.extract tarball
sudo env "PATH=$PATH" python3.6 setup.py install