目录

安装编译依赖

下载python包

解压编译&安装

连接文件

安装pip


安装编译依赖

yum -y install gcc automake autoconf libtool make zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

 

下载python包

https://www.python.org/downloads/source/

https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz

 

解压编译&安装

tar -xvzf   Python-3.6.9.tgz
cd Python-3.6.9
./configure prefix=/usr/local/python3
make && make install

 

连接文件

ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

 

安装pip

curl -o get-pip.py https://bootstrap.pypa.io/get-pip.py
python3  get-pip.py