Update Python to the latest version in CentOS.

Source: Internet
Author: User

Update Python to the latest version in CentOS.
Note: Do not delete old python versions 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.

Update python:

Step 2: Update gcc. If the gcc version is too old, the new python package cannot be compiled.

[Plain] view plaincopy
  1. # Yum-yinstallgcc
Step 2: Download the Python-2nd package [plain] view plaincopy
  1. # Wgethttp: // python.org/ftp/python/3.4.3/Python-3.4.3.tgz

Note: The software packages downloaded according to the preceding commands are stored in your current working directory. The wget command is a free tool for automatically downloading files from the network.

Note: The number in the command is the version number, which can be downloaded as needed.

Step 2: Decompress the downloaded Binary Package and compile and install it.

[Plain] view plaincopy
  1. # TarzxvfPython-3.4.3.tgz
  2. # CdPython-3.4.3
  3. #./Configure
  4. # Makeall
  5. # Makeinstall
  6. # Makeclean
  7. # Makedistclean
  8. #/Usr/local/bin/python3-V
After compilation and installation, enter the preceding command to view the version.

Step 2: Establish a soft connection to point to the bin directory of the default python command of the current system, so that the system can use the new version of python

[Plain] view plaincopy
  1. # Mv/usr/bin/python/usr/bin/python2.6 // The current python version is 2.6, so it is python2.6
  2. # Ln-s/usr/local/bin/python3.4/usr/bin/python
Enter # python-V to view the current default python version.
After the default python point to 3.4.3, yum cannot be used normally. You need to modify the yum configuration file.

Step 2: Modify the yum configuration file
[Plain] view plaincopy
  1. # Vim/usr/bin/yum
#! /Usr/bin/python #! /Usr/bin/python2.6 // change the old version
Save and exit. yum can be used normally. If other commands and software cannot be used normally, modify the configuration file just like the yum configuration file.

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.