1、下载压缩包:
wget http://npm.taobao.org/mirrors/python/3.9.6/Python-3.9.6.tgz
2、安装依赖:
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 install gcc
yum install libffi-devel -y
3、创建PYTHON安装目录:
mkdir -p /usr/local/python3
4、解压缩安装包:
tar -zxvf Python-3.9.6.tgz
5、进入解压缩后目录:
cd Python-3.9.6
./configure --prefix=/usr/local/python3 --enable-shared (第三步创建的目录)
6、编译和安装:
make
make install
7、创建软连接:
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
8、检查安装结果:
python3 -V
pip3 -V