centos6.X升级python3.X

centos6系列自带 python2.6版本,自己可升级python3.X
1.查看python版本
[root@localhost ~]# python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
2.下载python3.6的源码包
依赖wget,xz,gcc
[root@localhost ~]# wget http://mirrors.sohu.com/python/3.6.1/Python-3.6.1.tar.xz
3.安装python3.6
[root@localhost ~]# xz -d Python-3.6.1.tar.xz 
[root@localhost ~]# tar xvf Python-3.6.1.tar -C /usr/local/src/
[root@localhost ~]# cd /usr/local/src/Python-3.6.1/
[root@localhost Python-3.6.1]# ./configure --prefix=/usr/local/python3.6.1
[root@localhost Python-3.6.1]# make && make install
[root@localhost Python-3.6.1]# mv /usr/bin/python /usr/bin/python.bak
[root@localhost Python-3.6.1]# ln -s /usr/local/python3.6.1/bin/python3.6 /usr/bin/python
4.查看升级后版本
[root@localhost ~]# python
Python 3.6.1 (default, Jun 14 2017, 04:30:51) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

猜你喜欢

转载自blog.csdn.net/codercui/article/details/73251554