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 libffi-devel
2、下载python3.7.9安装包并解压缩
wget "https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz"
tar -zxvf Python-3.7.9.tgz
3、编译安装
cd Python-3.7.9
./configure --prefix=/usr/local/python3
make && make install
4、创建软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
5、验证
[root@seeker-01 ~]# python
Python 2.7.5 (default, Aug 7 2019, 00:51:29)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@seeker-01 ~]# python3
Python 3.7.9 (default, Aug 28 2020, 13:28:49)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
评论