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