1.安装依赖环境

    yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel

    yum -y install readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

 yum -y install libffi-devel mysql-devel gcc gcc-devel python-devel

2.下载python安装包

    wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

3.进入/usr/local目录下,新建python3文件夹
    cd /usr/local
    mkdir python3
4.将下载好的python压缩文件放置在linux的/usr/local/python3文件夹下,解压该压缩文件
    tar -zxvf Python-3.8.0.tgz
5.进入解压后的目录,编译安装
    cd /usr/local/python3/Python-3.8.0
    ./configure --prefix=/usr/local/python3
    make && make install
6.建立Python3和pip3的软链 ,替换python2 (多版本共存可不执行该操作)

mv /usr/bin/python /usr/bin/python.bak
 ln -s /usr/local/python3/bin/python3.8 /usr/bin/python
 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

7.将/usr/local/python3/bin加入PATH
    vim /etc/profile   //添加以下内容

  export PYTHON_HOME=/usr/local/python3
  export PATH=${PYTHON_HOME}/bin:$PATH

    source /etc/profile //让配置生效

8.检查Python3及pip3是否正常可用
    python -V
    pip -V