linux python升级及全局环境变量设置

1、下载python
wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz
或者去官网下载压缩包

2、安装python3依赖
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

3、解压安装
tar -xzvf Python-3.4.5.tgz
./configure –prefix=/usr/local/Python3
make
make install

4、老版本py2备份
mv /usr/bin/python /usr/bin/python_old

5、设全局变量
ln -s /usr/local/Python3/bin/python3 /usr/bin/python

6、修改yum解释器或升级yum
vi /usr/bin/yum
将第一行#!/usr/bin/python改为
#!/usr/bin/python2.7

    原文作者:zhylioooo
    原文地址: https://www.cnblogs.com/zhylioooo/p/10911023.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞