一: 下载所需安装包
wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz
下载之后解压:
tar xvf Python-3.8.13.tgz
二:创建python3文件夹, 进行编译安装
安装所需依赖:
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 gcc
编译:
cd Python-3.8.13
./configure --prefix=/usr/local/python3
编译后安装:
make && make install
完成之后配置软连接 并进行验证:
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
输入命令:
python3