美文网首页
CentOS 7 上安装 Python 3.x

CentOS 7 上安装 Python 3.x

作者: 默默熊 | 来源:发表于2019-01-11 14:46 被阅读12次

    方法一:
    1, Get source code
    cd
    wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
    xz -d Python-3.6.1.tar.xz
    tar xvf Python-3.6.1.tar

    2, Compile and install
    sudo mkdir /usr/local/python3
    cd Python-3.6.1
    sudo ./configure --prefix=/usr/local/python3 --enable-optimizations

    update zlib

    yum install zlib*
    vi

    sudo make
    sudo make install

    3, Replace python 2.x with python 3.x
    mv /usr/bin/python /usr/bin/python2.7.5
    ln -s /usr/local/python3/bin/python3.6 /usr/bin/python

    4, Update yum
    sudo vi /usr/bin/yum
    update the firstline, make sure it is the right path for python2

    5, Verify
    python
    yum

    方法二:
    sudo yum install epel-release
    sudo yum install python36

    相关文章

      网友评论

          本文标题:CentOS 7 上安装 Python 3.x

          本文链接:https://www.haomeiwen.com/subject/usztdqtx.html