美文网首页
CentOS 7.5 安装 Python3.7

CentOS 7.5 安装 Python3.7

作者: imsilence | 来源:发表于2018-03-30 11:46 被阅读673次
    1. 安装开发者工具
    yum -y groupinstall "Development Tools"
    
    1. 安装Python编译依赖包
    yum -y install openssl-devel zlib-devel bzip2-devel sqlite-devel readline-devel libffi-devel systemtap-sdt-devel
    
    1. 下载安装包
    wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
    
    1. 解压&编译
    tar zvxf Python-3.7.0.tgz
    cd Python-3.7.0
    ./configure --prefix=/usr/local/python3.7 --enable-optimizations
    make && make install
    
    1. 配置环境变量

    文件: /etc/profile.d/python37.sh

    if [ -z ${PYTHON37_HOME} ]; then
        export PYTHON37_HOME=/usr/local/python3.7
        export PATH=${PYTHON37_HOME}/bin:${PATH}
    fi
    
    1. 加载环境变量
    source /etc/profile.d/python37.sh
    
    1. 测试
    python3 -c "import sys; print(sys.version)"
    

    相关文章

      网友评论

          本文标题:CentOS 7.5 安装 Python3.7

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