Liunx系统升级自带的Python版本

Posted ヾJ﹍Hヾ

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Liunx系统升级自带的Python版本相关的知识,希望对你有一定的参考价值。

一、查看系统信息

[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[[email protected] ~]# uname -r
2.6.32-358.el6.x86_64

 

二、查看已安装python版本

[[email protected] ~]# rpm -qa|grep python
python-2.6.6-36.el6.x86_64
libxml2-python-2.7.6-8.el6_3.4.x86_64
python-urlgrabber-3.9.1-8.el6.noarch
python-iwlib-0.1-1.2.el6.x86_64
python-libs-2.6.6-36.el6.x86_64
rpm-python-4.8.0-32.el6.x86_64
dbus-python-0.83.0-6.1.el6.x86_64
python-iniparse-0.3.1-2.1.el6.noarch
python-pycurl-7.19.0-8.el6.x86_64
libproxy-python-0.3.0-3.el6_3.x86_64
libreport-python-2.0.9-15.el6.centos.x86_64
newt-python-0.52.11-3.el6.x86_64
python-ethtool-0.6-3.el6.x86_64
abrt-addon-python-2.0.8-15.el6.centos.x86_64
[[email protected] ~]# python -V
Python 2.6.6

 

三、下载编译安装python2.7.5版本源码包

[[email protected] ~]# cd /usr/local/src
[[email protected] ~]# wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz
[[email protected] ~]# tar xvf Python-2.7.5.tgz
[[email protected] ~]# cd Python-2.7.5
[[email protected] ~]# ./configure
[[email protected] ~]# make all
[[email protected] ~]# make install
[[email protected] ~]# make clean
[[email protected] ~]# make distclean

 

四、将系统默认的python版本设置为2.7.5

[[email protected] ~]# rm /usr/bin/python
[[email protected] ~]# ln -s /usr/local/bin/python2.7 /usr/bin/python

 

五、检查升级后的python版本

[[email protected] ~]# python -V
Python 2.7.5

 (转)https://blog.csdn.net/wailaizhu/article/details/54612982

以上是关于Liunx系统升级自带的Python版本的主要内容,如果未能解决你的问题,请参考以下文章

升级mac自带的python

liunx环境下:Python2.7与Django1.11.6环境搭建

centos升级系统自带的python2.6为python2.7

centos6.5系统自带python2.6升级到python2.7

MacOS升级Python

centos6 自带python2.6升级python2.7+