Ubuntu中安装python3解决ssl问题

在Ubuntu上安装Python3.7时,由于openssl 1.0.1的安全问题,需要升级到1.0.2或更高版本或使用libressl。本文详细介绍了如何从源码编译安装libressl,创建软连接替换openssl,并配置编译安装Python3.7,确保SSL兼容性。
摘要由CSDN通过智能技术生成

因openssl 1.0.1存在安全问题,python3自3.7版本后要求依赖openssl 1.0.2以上或libressl;错误提示如下:

Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_P

python3.7以上建议使用libressl代替openssl,故需通过源码编译安装libressl

下载源码包

wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.0.2.tar.gz

解压

tar -zxvf libressl-3.0.2.tar.gz

配置安装路径

mkdir /usr/local/libressl

cd libressl-3.0.2
./configure --prefix=/usr/local/libressl

安装

make & make install

创建软连接代替openssl

mv /usr/bin/openssl /usr/bin/openssl.bak

mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/libressl/bin/openssl /usr/bin/openssl
ln -s /usr/local/libressl/include/openssl /usr/include/openssl
echo /usr/local/libressl/lib >> /etc/ld.so.conf.d/libressl-3.0.2.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值