CentOS installs python2.7.8, and Yum does not expire

Source: Internet
Author: User

Install the dependency package before installing:

Yum Groupinstall "Development tools"
Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel Libpcap-devel Xz-devel

wget--no-check-certificate https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz

You need to pay special attention here, because the download URL is the beginning of HTTPS, so you want to add the--no-check-certificate parameter to the wget command.

After downloading the good source package, unzip:

TAR-ZXVF./python-2.7.8.tgz

After extracting the Python-2.7.8 directory, we started compiling the source code:


CD Python-2.7.8
./configure--prefix=/usr/local/python
Make
Make install

After compiling the installation, replace the python that comes with the system, but the CentOS Yum relies on Python, and in order to keep Yum running, we need to rename our own Python backup before replacing it with the following method:


mv/usr/bin/python/usr/bin/python-2.4.3
Ln-s/usr/local/python/bin/python/usr/bin/python

After the above two lines of commands are executed, you can use "python-v" and "/usr/bin/python-2.4.3-v" respectively to verify the success of the deployment, and the correct result should be 2.7.8 and 2.4.3.

Finally, to modify Yum, let it run to the old version:

Vi/usr/bin/yum

Modify "#!/usr/bin/python" in the first row to "#!/usr/bin/python-2.4.3" and save


CentOS installs python2.7.8, and Yum does not expire

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.