1.安装环境所需依赖
yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel wget
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc
yum -y install libffi-devel
2.下载python3安装包
python3所有版本地址:https://www.python.org/ftp/python/
3.7.9版本下载:
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
3.解压
tar xzvf Python-3.7.9.tgz
4.编译安装
cd Python-3.7.9
./configure --prefix=/usr/local/python3 --enable-optimizations
make && make install
5.添加环境变量
1)当前用户永久生效
vi ~/.bash_profile
/usr/bin/python3添加到PATH行最后,并用冒号隔开,保存退出
source ~/.bash_profile
2)所有