Upgrade Python to 3.2 in CentOS

Source: Internet
Author: User
In CentOS, the Python version is 2.4.3 by default, and we have a lot of work that may require a higher version. when we go to the Python official website, we find that the Python version has reached 3.2, then download and upgrade the Python version in CentOS. 1. download Python3.2. Address: http... in CentOS, the Python version is 2.4.3 by default, and we have a lot of work that may require a higher version. when we go to the Python official website, we find that the Python version has reached 3.2, then download and upgrade the Python version in CentOS.
 
1. download Python 3.2, address: http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2
 
2. install Python 3.2
 
 
 

 

# Go to shell
 
 

# Unpacking
 
 

$ Tar jxvf Python-3.2.tar.bz2
 
 

# Configure and install
 
 

$ Cd Python3.2
 
 

$./Configure
 
 

$ Make & make install
 
 

 
 
 
3. now we have installed python, but after entering the shell, we found that python is still version 2.4.3. we need to establish a link.
 
 
 

 

# Back up old file
 
 

$ Mv/usr/bin/python/usr/bin/python-2.4.3.bak
 
 

# Soft link to the python3.2
 
 

$ Ln-s/usr/locale/bin/python3.2/usr/bin/python
 
 

# Check the python version
 
 

$ Python-V
 
 

 
 
 
4. after the installation and configuration are complete, yum may not work properly and some configuration is required.
 
 
 

 

$ Vi/usr/bin/yum
 
 

# Change/usr/bin/python to #/usr/bin/python2.4
 
 

# Save wq
 
 

# Yum is normal now
 
 

 
 
 
The main reason is that we modified the default Python version to 3.2 and modified the default link. Yum needs to use the original version of python, resulting in unavailability. Therefore, you can call yum by specifying the python of the earlier version.

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.