python3.6安装

python3.6 安装

  1. 更新软件库

    yum update
    
    yum upgrade
    
  2. 安装相关依赖工具

    yum groupinstall 'Development Tools'
    
    yum install -y ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    
  3. 下载安装python 3.6.5

    cd /usr/local
    
    wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
    
    tar -xf Python-3.6.5.tar.xz
    
    mkdir python3
    
    mv Python-3.6.5 python3
    
    cd python3/Python-3.6.5
    

    --prefix: 将make后python3.6的所有资源文件都放在/usr/local/python3目录下。

    ./configure --prefix=/usr/local/python3 --enable-optimizations
    
    make
    
    make altinstall
    
  4. 配置新的python

    mv /usr/bin/python /usr/bin/python_old
    

    修改软连接

    ln -s /usr/local/python3/bin/python3.6 /usr/bin/python
    
    ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip
    
  5. 修改yum文件的头指定引用python2

    vi /usr/bin/yum
    

    改成#!/usr/bin/python2

  6. 检查是否安装配置好python3.6

    python
    
    pip -V
    

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