How to install a common Python version under CentOS

Source: Internet
Author: User
Tags bz2 centos

Install python2.7.3

The code is as follows Copy Code

Wget-c http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Tar zxvf python-2.7.3.tgz
CD Python-2.7.3
./configure
Make && make install
Mv/usr/bin/python/usr/bin/python_bak
Ln-s/usr/local/bin/python/usr/bin/python
echo "/usr/local/lib" >>/etc/ld.so.conf

Install Python3

Download:

The code is as follows Copy Code

Wget-c http://www.python.org/ftp/python/3.1.3/Python-3.1.3.tar.bz2

Decompression Compile Installation:
$ TAR–JXVF python-2.5.2.tar.bz2
$ CD Python-2.5.2
$./configure
$ make
$ make Install

Since the default installation of CentOS is 2.4, direct input to Python is 2.4

The code is as follows Copy Code

# python
Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
[GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>>

The following modifications can be resolved

  code is as follows copy code

cd / Usr/bin
ll |grep python
ln-s/root/python-3.1.3/python  ./python   ///root/python-3.1.3/ Python for the Extract directory
now input python display as 3.1 of the
[root@chxy bin]# python
python 3.1.3 (r313:86834, jan  2 2011, 02:12:38) br> [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for more inform ation.
>>>

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.