编译包安装python3.6.8

上传python包

[root@python ~]# ls
anaconda-ks.cfg  Python-3.6.8.tgz

解压

[root@python ~]# tar zxvf Python-3.6.8.tgz 
[root@python ~]# ls
anaconda-ks.cfg  Python-3.6.8  Python-3.6.8.tgz

安装环境

yum install gcc -y
yum install -y openssl-devel
yum -y install zlib*
yum install -y libffi-devel

指定安装路径

cd Python-3.6.8
./configure --prefix=/usr/local/python3

开始编译

make
make install

完成安装

ln -s /usr/local/python3/bin/python3 /usr/bin
[root@python ~]# python3
Python 3.6.8 (default, May 27 2021, 23:36:45) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>