CentOS7下安装python3.7
以原码编译的方式安装
1.官网下载python3.7软件包
2.上传至Linux中,并解压
tar -zxvf python-3.7.2.tgz
3.安装gcc和python所需依赖
yum -y install gcc
yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel
4.创建安装python所需的目录
mkdir -p /usr/local/python3.7
4.进入解压后的目录执行以下命令
./configure --prefix=/usr/lcoal/python3.7 #指定安装目录
make && make install
5.创建软链接
ln -s /usr/local/python3.7/bin/python3 /usr/local/bin/python3
ln -s /usr/lcoal/python3.7/bin/pip3 /usr/local/bin/pip3