Upgrade python2.6 to 2.7 in Centos

Source: Internet
Author: User
1. view the current Python version [plain] viewplaincopy # python-VPython2.6.6

1. view the current Python version

[Plain]View plain copy
  1. # Python-V
  2. Python 2.6.6

 

2. download Python2.7.5 source code

 

[Html]View plain copy
  1. # Wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz

3. decompress the source code package

 

 

[Html]View plain copy
  1. # Tar xvf Python-2.7.5.tgz

4. go to the extract directory and install

 

 

[Html]View plain copy
  1. # Cd Python-2.7.5
  2. #./Configure
  3. # Make all
  4. # Make install
  5. # Make clean
  6. # Make distclean

 

5. set the default python to python2.7.5.

 

[Plain]View plain copy
  1. # Rm/usr/bin/python
  2. # Ln-s/usr/local/bin/python2.7/usr/bin/python

 

6. check the Python version.

 

[Plain]View plain copy
  1. # Python-V
  2. Python 2.7.5

 

7. solve the problem that yum cannot run.

Because yum runs on python2.6.6, you need to make some modifications to yum.

 

[Plain]View plain copy
  1. # Vim/usr/bin/yum

 

Set the #! of the first line #! /Usr/bin/python #! /Usr/bin/python2.6

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.