CentOS6安装Python3.8.0
1. 安装编译相关工具
yum -y groupinstall "Development tools"
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 libffi-devel -y
2. 下载安装包解压
如果wget不能用,可以先用浏览器下载.tar.xz文件,然后上传至服务器并进行解压使用
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
tar -xJvf Python-3.8.0.tar.xz
3.编译安装
mkdir /usr/local/python8 #创建编译安装目录
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make && make install
4. 创建软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
5. 验证是否安装成功
python --version
pip3 --version