背景:
python版本:3.9.15
OS:openEuler 20.03 SP1
软件栈:系统自带gcc、g++、gfortran
依赖库:yum install gcc libffi* openssl-devel zlib* bzip2 gcc-c++ gcc-gfortran readline-devel
报错现象:
cd /home
wget https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tar.xz --no-check-certificate
tar xf Python-3.9.15.tar.xz
cd Python-3.9.15
./configure --prefix=/home/Python-3.9.15_install --enable-shared --enable-optimizations --with-ssl-default-suites=openssl
make -j

解决方案:
建议使用libressl替代openssl,libressl 是 openssl 更安全版本分支。
cd /home
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.4.tar.gz --no-check-certificate
tar xf libressl-2.7.4.tar.gz
cd libressl-2.7.4
./configure --prefix=/home/libressl-2.7.4_install
make -j
make install
export PATH=/home/libressl-2.7.4_install/bin:$PATH
export LD_LIBRARY_PATH=/home/libressl-2.7.4_install/lib:$LD_LIBRARY_PATH
export INCLUDE=/home/libressl-2.7.4_install/include:$INCLUDE
安装完成libressl后,重新安装python3
cd /home
rm -rf /home/Python-3.9.15
tar xf Python-3.9.15.tar.xz
cd Python-3.9.15
sed -i "214,217s/^#//g" Modules/Setup
sed -i "214s%/usr/local/ssl%/home/libressl-2.7.4_install%g" Modules/Setup
./configure --prefix=/home/Python-3.9.15_install --enable-shared --enable-optimizations
make -j
make install
export PATH=/home/Python-3.9.15_install/bin:$PATH
export LD_LIBRARY_PATH=/home/Python-3.9.15_install/lib:$LD_LIBRARY_PATH
此时已安装完成python3,在服务器中输入python3,再输入import ssl,无报错信息,即安装ssl模块完成

背景:
python版本:3.9.15
OS:openEuler 20.03 SP1
软件栈:系统自带gcc、g++、gfortran
依赖库:yum install gcc libffi* openssl-devel zlib* bzip2 gcc-c++ gcc-gfortran readline-devel
报错现象:
cd /home
wget https://www.python.org/ftp/python/3.9.15/Python-3.9.15.tar.xz --no-check-certificate
tar xf Python-3.9.15.tar.xz
cd Python-3.9.15
./configure --prefix=/home/Python-3.9.15_install --enable-shared --enable-optimizations --with-ssl-default-suites=openssl
make -j
解决方案:
建议使用libressl替代openssl,libressl 是 openssl 更安全版本分支。
cd /home
wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.4.tar.gz --no-check-certificate
tar xf libressl-2.7.4.tar.gz
cd libressl-2.7.4
./configure --prefix=/home/libressl-2.7.4_install
make -j
make install
export PATH=/home/libressl-2.7.4_install/bin:$PATH
export LD_LIBRARY_PATH=/home/libressl-2.7.4_install/lib:$LD_LIBRARY_PATH
export INCLUDE=/home/libressl-2.7.4_install/include:$INCLUDE
安装完成libressl后,重新安装python3
cd /home
rm -rf /home/Python-3.9.15
tar xf Python-3.9.15.tar.xz
cd Python-3.9.15
sed -i "214,217s/^#//g" Modules/Setup
sed -i "214s%/usr/local/ssl%/home/libressl-2.7.4_install%g" Modules/Setup
./configure --prefix=/home/Python-3.9.15_install --enable-shared --enable-optimizations
make -j
make install
export PATH=/home/Python-3.9.15_install/bin:$PATH
export LD_LIBRARY_PATH=/home/Python-3.9.15_install/lib:$LD_LIBRARY_PATH
此时已安装完成python3,在服务器中输入python3,再输入import ssl,无报错信息,即安装ssl模块完成