CentOS native Python is 2.6.6 and can be viewed by the following command
# python-v 2.6. 6
1. Download the Python version you need
To download the required version of the https://www.python.org/downloads/website, the current version of Linux used is. tgz or. tar.xz version.
2. Unzip the download file
Taking Tar.xz as an example
# xz-d PYTHON-2.7.8.TAR.XZ#TAR-XVF Python-2.7.8.tar
3. Compiling & Installing
Because the compilation requires GCC support, if it is not installed, install GCC, #yum installed GCC
# CD Python-2.7.8#./configure#make all #make install#make clean#make Distclean
4, cancel the original link, create a new version of the link
# mv/usr/bin/python/usr/bin/python2.6.6#ln-s/usr/local/bin/python2.7/usr/bin/python
5. Check the current version of Python
# python-v 2.7. 8
6, because Yum does not have compatible python2.7, it is necessary to change the red part below from #!/usr/bin/python to #!/usr/bin/python2.6.
Nano/usr/bin/yum
#!/usr/bin/python
Modified to:
#!/usr/bin/python2.6
Centos6.6 Upgrade Python version