Python upgrade in Linux

Source: Internet
Author: User

Link: http://blog.pmal.net/2011/03/02/linux_python_upgrade/

I have been learning Python recently, but the built-in Python 2.4.3 is too old.
The website has been upgraded to 3.2.
I chose to upgrade to 2.7 on the official website. Because my teaching materials support more than 2.5, 3.2 is still too new, and it is almost the same as upgrading to 2.7.
Download source code

1 wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz

All my software is downloaded under/data0/software,
In this directory, decompress

1 tar -zxvf Python-2.7.1.tgz
2 cd Python-2.7.1

Start compiling

1 mkdir /usr/local/python27

I created a directory
During compilation

1 ./configure --prefix=/usr/local/python27
2 make
3 make install

The old version has not been overwritten.
Then change the original

1 /usr/bin

The following python links are all deleted or changed to another name.

1 mv /usr/bin/python /usr/bin/python_old

Enter

1 ln -s /usr/local/python27/bin/python /usr/bin/

Enter

1 python

The following code is displayed:

1 Python 2.7.1 (r271:86832, Mar  2 2011, 12:06:34)
2 [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
3 Type "help",
"copyright", "credits"
or "license"
for
more information.

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.