centos7 安装 python3.7

  • 安装依赖

    yum -y groupinstall "Development tools"
    
    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
    
    yum install libffi-devel -y
    
  • 下载安装包

    wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
    tar -xvf  Python-3.7.0.tar.xz
    
  • 切入安装包

    cd Python-3.7.0
    
  • 配置

    ./configure --enable-optimizations  --prefix=/usr/local/python3
    
  • 编译和编译安装

    make && make install
    
  • 建立软连接

    ln -s /usr/local/python3/bin/python3.7  /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
    
  • 测试

    > python3
    > pip3 list
    
  • 至此python3.7的环境搭建成功

posted @ 2020-03-20 12:10  巫小诗  阅读(156)  评论(0编辑  收藏  举报