Liunx系統升級自帶的Python版本

1、查看系統信息python

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

 

2、查看已安裝python版本centos

[root@localhost ~]# 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
[root@localhost ~]# python -V
Python 2.6.6

 

3、下載編譯安裝python2.7.5版本源碼包python2.7

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

 

4、將系統默認的python版本設置爲2.7.5curl

[root@localhost ~]# rm /usr/bin/python
[root@localhost ~]# ln -s /usr/local/bin/python2.7 /usr/bin/python

 

5、檢查升級後的python版本url

[root@localhost ~]# python -V
Python 2.7.5

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

相關文章
相關標籤/搜索