CentOS7编译安装Python3.10.10

下载必要的软件包

yum update

yum install -y gcc libffi-devel zlib-devel readline-devel

yum install -y epel-release.noarch

yum install -y openssl11 openssl11-devel

yum install bzip2 bzip2-devel sqlite-devel

 

下载Python源码并解压

yum -y install wget

wget https://www.python.org/ftp/python/3.10.10/Python-3.10.10.tgz

tar xzf Python-3.10.10.tgz

 

编译

cd Python-3.10.10

sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure

./configure

make -j 4

 

安装

make altinstall

 

测试安装

python3.10 --version

 

设置软连接

目的是为了使用python3和pip3这样更简短的命令

ln -s /usr/local/bin/python3.10 /usr/bin/python3

ln -s /usr/local/bin/pip3.10 /usr/bin/pip3

THE END
分享
二维码
海报
CentOS7编译安装Python3.10.10
下载必要的软件包 yum update yum install -y gcc libffi-devel zlib-devel readline-devel yum install -y epel-release.noarch yum install -y openssl11 op……