Steps to update the Python version under CentOS _python

Source: Internet
Author: User
Tags bz2 centos
After the installation of CentOS5.9 (Final), the implementation of #python and #python-v, see version number is 2.4.3, very old, and previously written are running on the python3.x above, 3.X and 2.X have a lot of different, interested friends can refer to this article:

Http://www.jb51.net/article/34011.htm

Update python don't delete old versions! Old and new versions can coexist, and many basic commands and packages are dependent on the pre-installed old version of Python, such as Yum.

Update Python:

step 1th: Update gcc because the GCC version is too old to cause the new version of Python package compilation to be unsuccessful

Copy Code code as follows:

#yum-y Install gcc


The system will automatically download and install or update, and so it ends itself

2nd step: Download the Python-3.3.0 package

Copy Code code as follows:

#wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2


Note: Packages downloaded in accordance with the above commands will be stored in your current working directory, wget command is a free tool to download files automatically from the network, for specific purposes, please refer to this article: http://www.jb51.net/os/RedHat/73089.html

Description: The number in the command is the version number, you can also change the 3.3.0 to the version you need, as of the date I wrote (January 29, 2013), the latest available version is 3.3.0

3rd Step: Unzip the downloaded binary package and compile the installation

Copy Code code as follows:

#tar-JXVF python-3.3.0.tar.bz2
#cd Python-3.3.0
#./configure
#make All
#make Install
#make Clean
#make Distclean
#/usr/local/bin/python3–v


After compiling the installation, you can enter the line above to view the version

Step 4th: Establish a soft connection the bin directory that points to the current system default Python command, let the system use the new version of Python
#mv/usr/bin/python/usr/bin/python2.4//Current Python version is 2.4 so it's python2.4.
#ln-S/usr/local/bin/python3.3/usr/bin/python
Enter #python-v to view the current default Python version
After the default Python successfully points to 3.3.0, Yum does not work properly and needs to modify the Yum configuration file

Step 5th: Modify the Yum configuration file

#vi/usr/bin/yum
Change the #!/usr/bin/python of the head of the document to #!/usr/bin/python2.4//to the old version number
Save exit, Yum can be used normally. If there are other commands, the software can not be used normally, modelled on the Yum configuration file modification method, modify its configuration file.
At this point, the update is complete.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.