安装依赖
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
下载安装
#下载安装包
wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
#解压
tar -zxvf Python-3.9.13.tgz
#创建一个安装目录,根据自己需要创建
mkdir /usr/local/python3
#进入刚解压的源码包
cd Python-3.9.13
#安装到指定目录和编译
./configure --prefix=/usr/local/python3
make && make install
配置软连接
ln -sf /usr/local/python3/bin/python3 /usr/bin/python3
ln -sf /usr/local/python3/bin/pip3 /usr/bin/pip3
0则评论给“centos7 安装 python3.9”