shell脚本编写–自动化安装python
centos7 安装 python3
可以选择手动安装:
1.依赖下载
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 wget
yum install libffi-devel -y
yum install gcc -y
2.下载指定的python版本
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xf Python-3.7.0.tgz
cd Python-3.7.0
3.编译安装,执行测试,建立软连接
./configure --prefix=/usr/local/python3
make
make install
/usr/local/python3/bin/python3.7
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
4.其他版本参考
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz