Install Python under CentOS

Source: Internet
Author: User
Tags install openssl

Download URL: http://ftp.gnu.org/gnu/gdb/

1. compiling python must install development tools

# yum Groupinstall "Development tools"

2. other required modules

# yum Install Zlib-devel
# yum Install Bzip2-devel
# yum Install Openssl-devel
# yum Install Ncurses-devel

3, download, compile, install Python 2.7.3

# Tar XF python-2.7.3.tar.bz2
# CD Python-2.7.3
#./configure--prefix=/usr/local
# Make && make Altinstall

The point is altinstall instead of install, so the python just installed is here:/usr/local/bin/python2.7, and the system Python is here:/usr/bin/python and/usr /bin/python2.6.

4. Installation Configuration Setuptools

# wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.27.tar.gz
# Tar XF distribute-0.6.27.tar.gz
# CD distribute-0.6.27
# python2.7 setup.py Install

This command generates a/usr/local/bin/easy_install-2.7 script. And this script can be used to install other Python package

# easy_install-2.7 Virtualenv

Other package can be installed similar to complete. In addition, the command line can be entered directly into the python2.7 python2.7 environment, if it is python into the 2.6.6 environment. Of course, you can also link the Python 2.7 command link to Python, and the system itself, the Python 2.6.6 changes, change the configuration file. Make an analogy.

Cd/usr/bin
RM-RF python
Ln-s/usr/local/bin/python2.7 python
After doing this, it may cause a problem that the Yum command is not available, and you need to modify Yum
Vi/usr/bin/yum
Modify the Python path for the first line #!/usr/bin/python2.6 because CentOS is used python2.6

Install Python under CentOS

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.