安装依赖
yum install -y gcc gcc-c++ zlib zlib-devel openssl openssl-devel
创建安装目录
mkdir /usr/local/python3
上传源文件并解压
Python-3.6.4.tgz到/usr/lcoal/src
解压文件
tar -zxvf Python-3.6.4.tgz
编译安装
cd Python-3.6.4
./configure --prefix=/usr/local/python3
make & make install
检查
/usr/local/python3/bin/python3.6
建立python3和pip3的软连接
[root@localhost ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
[root@localhost ~]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
检查
[root@localhost ~]# python3
Python 3.6.4 (default, Jul 7 2020, 13:25:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>