Centos7下python2.7升级至3.6

1.下载python3.6:wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

2.解压:tar -xzf Python-3.6.4.tgz

3.安装:cd Python-3.6.4

    ./configure --prefix=/usr/local/python3.6

    make

    make install

4.备份:mv /usr/bin/python /usr/bin/python2.7.5

5.修改软连接:

    ln -fs /usr/local/python3.6/bin/python3.6 /usr/bin/python
    ln -fs /usr/local/python3.6/bin/pip3.6 /usr/bin/pip

6.验证:python -V

    pip -V

7.修改yum文件:

    vi /usr/bin/yum

    vi /usr/libexec/urlgrabber-ext-down

    第一行改为:#!/usr/bin/python2.7

8.升级:

    python -m pip install --upgrade pip

posted @ 2019-04-28 16:34  qcuser  阅读(2401)  评论(0编辑  收藏  举报