Whim, want to learn python, I heard it is good to do reptiles. Starting with the running environment, Python is already built into the CentOS, but the version seems older and the version is 2.4.3 through the PYTHON-V command. The current version of Python 2.x is 2.7.8, so start to upgrade.
First, download the source package, which commands the following:
wget--no-check-certificate https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
Here you need to pay special attention, because the download URL is the beginning of HTTPS, so the wget command to add--no-check-certificate parameters.
After downloading the good source package, decompression:
TAR-ZXVF./python-2.7.8.tgz
After extracting the directory of Python-2.7.8, we started compiling the source code:
CD Python-2.7.8
./configure--prefix=/usr/local/python
Make
Make install
After compiling the installation, to replace the system from the Python, but CentOS Yum rely on Python work, in order to ensure the normal operation of the Yum, we need to replace, before the replacement, the Python renamed to Backup, the following methods:
mv/usr/bin/python/usr/bin/python-2.4.3
Ln-s/usr/local/python/bin/python/usr/bin/python
Once the above two lines have been executed, you can verify the success of the deployment by using "Python-v" and "/usr/bin/python-2.4.3-v" respectively, and the correct result should be 2.7.8 and 2.4.3.
Finally, to modify the Yum to run to the old version:
Vi/usr/bin/yum
Modify the "#!/usr/bin/python" in the first row to "#!/usr/bin/python-2.4.3" and save