CentOS 7.8编译安装python 3.7

1. 安装gcc等编译器、依赖库

yum install gcc gcc-c++ zlib zlib-devel bzip2-devel xz-devel libffi-devel make -y

2. 安装libressl

wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.0.tar.gz --no-check-certificate
tar zxvf libressl-3.7.0.tar.gz
cd libressl-3.7.0
./configure --prefix=/usr/local/ssl
make install

cd /etc/ld.so.conf.d 
echo "/usr/local/ssl/lib" > libressl-3.7.conf 
ldconfig -v

mv /usr/bin/openssl /usr/bin/openssl.bak  
mv /usr/include/openssl  /usr/include/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl 
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

3. 下载并编译python3.7

export LDFLAGS="-L/usr/local/ssl/lib" 
export CPPFLAGS="-I/usr/local/ssl/include" 
export PKG_CONFIG_PATH="/usr/local/ssl/lib/pkgconfig"

wget https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tgz
tar zxvf Python-3.7.12.tgz
cd Python-3.7.12
./configure  --prefix=/usr/lib/python37/ --enable-optimizations --with-ssl
make install
ln -s /usr/lib/python37/bin/python3 /usr/bin/python3
ln -s /usr/lib/python37/bin/pip3 /usr/bin/pip3
cp /usr/lib64/python3.6/lib-dynload/_bz2.cpython-36m-x86_64-linux-gnu.so /usr/lib/python37/lib/python3.7/lib-dynload/_bz2.cpython-37m-x86_64-linux-gnu.so

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值