CentOS6.5 system upgrade from Python2.6.6 to python2.7.3

Source: Internet
Author: User
Tags goagent
Upgrade Python2.6.6topython2.7.3 under Centos6.5. for me who don't use Pyhthon, the Python version has little to do with me, but I used to use SSH and suddenly wanted to switch to GoAgent, I suddenly realized that my Python version was too low and I upgraded it. Update History 1. download Python-2.7.3wgethttp: // pyt Upgrade Python 2.6.6 to python 2.7.3 under Centos6.5

For me who won't use Pyhthon, the Python version has little to do with me, but I used to use SSH and suddenly wanted to switch to GoAgent, I suddenly realized that my Python version was too low and I upgraded it.

The following are the update records

1. download the Python-2.7.3

Wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2

2. decompress Python-2.7.3

Tar-jxvf Python-2.7.3.tar.bz2

3. install Python-2.7.3

At this point, it should also go smoothly, but at the end, it prompts "ImportError: No module named _ ssl ".

Ssl is installed by default.

3.1 First install the openssl package

Yum install openssl-devel-y

3.2 enable ssl

Vim/usr/software/Python-2.7.5/Modules/Setup. dist

Find the SSL-related part and remove the comment.

# The modification result is as follows:
# Socket module helper for socket (2)
_ Socket socketmodule. c timemodule. c
# Socket module helper for SSL support; you must comment out the other
# Socket line above, and possibly edit the SSL variable:
# SSL =/usr/local/ssl
_ Ssl. c \
-DUSE_SSL-I $ (SSL)/include/openssl \
-L $ (SSL)/lib-lssl-lcrypto

3.3 install Python

./Configure
Make all
Make install
Make clean
Make distclean

3.4 view the Python version just installed

/Usr/local/bin/python2.7-V

3.5 but python-V is still 2.6.6. in this case, we need to point the default python version to version 2.7.

Mv/usr/bin/python/usr/bin/python2.6.6
Ln-s/usr/local/bin/python2.7/usr/bin/python

Then you can use python-V to view the result and it will be displayed as 2.7.3.

4. after the system python soft link points to python 2.7, yum cannot work normally.

Vim/usr/bin/yum

Place
#! /Usr/bin/python
Change
#! /Usr/bin/python2.6.6

Related Article

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.