Python upgrade to python2.7

Source: Internet
Author: User

View the version of Python

[root@localhost ~] Python- v
Python 2.4.3

1. Install GCC First

Yum- y install gcc If there is an error installing GCC,Yum Distro-syncYum Clean All

2. Download Python-2.7.2

[root@localhost ~] wget http://python.org/ftp/python/2.7.2/ python-2.7.2.tar.bz2

3. Unzip the Python-2.7.2

[root@localhost ~] tar -jxvf python-2.7.2.tar.bz2

4. Go to the folder you just unzipped (you can use the command):

[root@localhost ~] cd Python-2.7.2

5. Installation

[Root@localhost Python-2.7.2]. /configure
[Root@localhost Python-2.7.2] make all
[Root@localhost Python-2.7.2] make Install
[Root@localhost Python-2.7.2] make clean
[Root@localhost Python-2.7.2] make distclean

6. View version Information

/ usr/local/bin/python2.7- v

7. Establish a soft connection so that the system default Python points to python2.7
Under normal circumstances, even if the python2.7 installation succeeds, the system pointing to Python is still the 2.4.3 version, considering that Yum is based on python2.4.3 to work properly and does not dare to uninstall easily.
How do you point to the system default Python to version 2.7?

mv/ usr/bin/python/ usr/bin/python2.4
LN- S/ usr/local/bin/python2.7/ usr/bin/python

Verify that the Python point is successful

Python- v

8. Fix system Python soft links to python2.7 version, Yum does not work properly

vi /usr/bin/yum

The file header is

#!/usr/bin/python

Change into

#!/usr/bin/python2.4

Python upgrade to python2.7

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.