Update the Python version of CentOS

Source: Internet
Author: User

Update the Python version of CentOS

Because a program installed in the CentOS system requires a high version of Python, you must upgrade the Python that comes with the system.

First, query the Python version of the system.

# Python-V

Show is 2.4.3, too old, now upgrade to relatively stable version 3.3.0, you want to upgrade to the latest version can refer to the official website (https://www.python.org/downloads ).

Tip: Do not delete the old version when updating python! New and old versions can coexist. Many basic commands and software packages must depend on the pre-installed old version of python, such as yum.

Upgrade GCC to the latest version to prevent compilation failure.

# Yum-y install gcc

Start upgrading work: # wget http://python.org/ftp/python/3.3.0/Python-3.3.0.tar.bz2

# Tar-jxvf Python-3.3.0.tar.bz2
# Cd Python-3.3.0
#./Configure
# Make all
# Make install
# Make clean
# Make distclean

Compilation and installation are complete. Enter the following command to view the version

#/Usr/local/bin/python3-V

Set up a soft connection to the bin directory of the default python command in the current system.

# Mv/usr/bin/python/usr/bin/python2.4 // The current python version is 2.4, so it is python2.4
# Ln-s/usr/local/bin/python3.3/usr/bin/python

Enter the following command to view the version

#/Usr/local/bin/python3-V

The query version is 3.3.0. However, yum cannot be used normally. You need to modify the yum configuration file.

# Vi/usr/bin/yum

#! /Usr/bin/python #! /Usr/bin/python2.4 // change to the old version number
Save and exit.

The upgrade is complete.

The uninstallation method is attached as follows:

We still remember to use the following command to install the python package: python setup. py install

# Python setup. py install -- record files.txt record the path of the file after installation
# Cat files.txt | xargs rm-rf delete these files

Directly run Python code without the need for the operating system

Install Python3.4 on CentOS source code

Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]

Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]

Obtain Linux information using a Python script

Build a desktop algorithm transaction research environment using Python in Ubuntu

A Brief History of Python Development

Python details: click here
Python: click here

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.