centos7 安装python3

首先安装openssl
yum安装openssl-devel
[root@localhost ~]# yum install openssl-devel -y
查看安装结果
[root@localhost ~]# rpm -aq|grep openssl
openssl-devel-1.0.2k-12.el7.x86_64
openssl-libs-1.0.2k-12.el7.x86_64
openssl-1.0.2k-12.el7.x86_64

  1. wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz

  2. tar -xvf Python-3.7.1.tar.xz
    安装zlib依赖
    3 yum -y install zlib*
    安装ibffi-devel依赖

  3. yum install libffi-devel -y
    安装 gcc-c依赖
    yum install gcc-c++

  4. ./configure --prefix=/usr/python3

  5. make && make install
    7 mv /usr/bin/python /usr/bin/python.bak
    8 ln -s /usr/python3/bin/python3 /usr/bin/python

  6. ln -s /usr/python3/bin/pip3 /usr/bin/pip3

修正 yum 链接,修改文件 /usr/libexec/urlgrabber-ext-down ,vi /usr/bin/yum
指定python版本为系统自带版本

! /usr/bin/python 修改为 #! /usr/bin/python2.7

错误问题详解
https://www.cnblogs.com/kerbside/p/9494307.html

你可能感兴趣的:(centos7 安装python3)