Centos7下python2.7升级至3.6

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

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?