Install Python 2.7.5 on CentOS 6.4

Source: Internet
Author: User
Tags gz file

Find a new job for python development. You need to learn python from the beginning.

Python 2.7.* is used in the working environment, but the default python version in CentOS 6.4 is 2.6.6. Therefore, an upgraded version is required.

The installation procedure is as follows:

1. First install GCC and run the following command: yum install gcc GCC-c ++

2. Download The python-2.7.5.tar.gz file and modify the File Permission chmode + x python-7.5.tar.gz

3, extract the tar file, tar-xzvf python-2.7.5.tar.gz

4. cd python-2.7.5

./Configure -- prefix =/usr/local/python27 ### Note: install it in a new directory to prevent overwriting of python installed by default.

Make & make install

5. Establish a soft connection to point python to python27 by default.

Mv/usr/bin/python/usr/bin/python2.6.6.old

Ln-s/usr/local/bin/python27/usr/bin/python

Python installation or upgrade has been completed. Let's take a look at the current python version:

# Python-V

Python 2.7.5

Although python has been installed, the yum command may be faulty-yum cannot work properly:

# Yum list

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

Current version of Python

This is because the default python version of yum is 2.6.6 and the current python version is 2.7.5, you only need to configure the default python version of yum:

# Vi/usr/bin/yum

#! Change/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.