centos7安装python3
安装依赖包
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 -y libffi-devel zlib1g-dev
yum install zlib* -y
下载python3.7.2安装包
wget wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
解压python3.7.2安装包
tar -xvJf Python-3.7.2.tar.xz
创建编译安装目录
mkdir /usr/local/python3
安装
cd Python-3.7.2
./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
make && make install
创建好软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
看看是否安装
python3 -V