1. 安装gcc编译器,如果存在就不需要安装了yum -y install gcc
  2. 安装其他的依赖包:

     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
  3. 安装wget,如果存在就不用安装yum -y install wget
  4. 下载wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
  5. 解压tar -zxvf Python-3.7.0.tgz
  6. 新建一个用于存放python的文件夹mkdir /usr/local/python3
  7. 编译安装

    cd Python-3.7.0
    ./configure --prefix=/usr/local/python3
    make && make install
  8. 建立软链接

     ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
     ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
  9. 测试
    输入python3回车出现如下画面就成了
    1.png

    输入exit()即可退出。

Last modification:January 31, 2019
If you think my article is useful to you, please feel free to appreciate