跳转到主要内容

Linux

CentOS

安装编译环境

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

下载源码

yum -y install wget
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz

编译安装

mkdir /usr/local/python3.9
tar -zxvf Python-3.9.0.tgz
cd  Python-3.9.0
./configure --prefix=/usr/local/python3.9
make && make install

创建软连接

ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3.9
ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3.9