As a result of development, we upgraded the python 2.6.6 that comes with CentOS 6.4 to Python 2.7.3. follow the steps below to upgrade it.
1. view the python version of the current system.
2. Download Python 2.7.3
| 1 |
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 |
3. decompress and install
| 1234567 |
tar -jxvf Python-2.7.3.tar.bz2# Enter the decompressed directorycd Python-2.7.3# Compilation and Installation./configuremakemake install |
4. Check whether the installation is successful.
| 123 |
/usr/local/bin/python2.7 -V# If the following information is displayed, the installation is successful.Python 2.7.3 |
5. Create soft links
| 12345678 |
# Under normal circumstances, even if python2.7 is successfully installed, the python to which the system points is still 2.6.6 by default. Considering that yum works normally based on python2.6.6, it is not recommended to uninstall it.# Use the following method to change the default python version to 2.7.3.mv /usr/bin/python /usr/bin/python2.6.6ln -s /usr/local/bin/python2.7 /usr/bin/python# Check whether it is successfulpython -V# If version 2.7.3 is displayed, the request is successful.Python 2.7.3 |
6. solved the problem of yum unavailability after the default python version of the system is modified.
| 12 |
# Modifying the yum Filevi /usr/bin/yum |
Place
Change to the following content:
The entire upgrade process is complete.
7. Other problems
After the above six steps, yum is available, but I don't know which one has modified the system file. As a result, the system still prompts no named yum error when using yum. After reading the relevant information, we learned that the python version of the yum header was modified.
But I have modified it (Step 6) And I don't know how to solve it. Finally, I gave up "du Niang" and found a document on the Centos official website using Google, which is often harmonious. The method is as follows.
First, find the CD or ISO file on which you install Centos, as long as the system version is the same. Copy the following file to the system:
| 12345 |
python-2.6.6-36.el6.x86_64.rpmpython-urlgrabber-3.9.1-8.el6.noarch.rpmpython-devel-2.6.6-36.el6.x86_64.rpmpython-libs-2.6.6-36.el6.x86_64.rpmyum-3.2.29-40.el6.centos.noarch.rpm |
The specific version number is subject to your system disk or ISO. I copied it to the following directory:
| 1 |
/usr/local/src/Python-2.6.6 |
Install
| 123456789 |
cd /usr/local/src/Python-2.6.6/rpm -Uvh --replacepkgs *.rpm# The following prompt is displayed:Preparing... ########################################### [100%]1:python-libs ########################################### [ 20%]2:python ########################################### [ 40%]3:python-urlgrabber ########################################### [ 60%]4:yum ########################################### [ 80%]5:python-devel ########################################### [100%] |
Run the yum command. The interface you are familiar with appears ~~
Related reading: Python upgrade of CentOS 5.6 and Yum Tool Repair