一、下載安裝包,然後進行升級部署
[root@a2 tmp]# tar zxvf Python-2.7.3.tgz [root@a2 Python-2.7.3]# ./configure && make && make install [root@a2 Python-2.7.3]# which python /usr/local/bin/python [root@a2 Python-2.7.3]# ln -sf /usr/local/bin/python /usr/bin/python [root@a2 Python-2.7.3]# python -V Python 2.7.3
二、處理升級後,yum的情況
由於Python升級後,看下原有yum是否還能正常使用
[root@a2 Python-2.7.3]# yum clean all There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named yum Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.7.3 (default, Dec 17 2013, 17:33:06) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq
三、修改yum配置文件
[root@a2 Python-2.7.3]# vim /usr/bin/yum 將“#!/usr/bin/python”改爲“#!/usr/bin/python2.4” [root@a2 Python-2.7.3]# yum clean all Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Cleaning up Everything