The simple thing that Lao Zuo is familiar with ASP and PHP is that he can understand and modify them. Other languages such as Python are basically illiterate, but some of them need to support Python 2.7 when testing and practicing some tutorials. The default CentOS is 2.4.3. So it is necessary to upgrade before I can use the backup script I will test (version 2.7 is required for 7N storage backup).
Similarly, many online tutorials were found either because the data source was faulty or the script was unclear, at least for novices. The following method and process can upgrade the Python version. I also tested it three times (my system is centos 5).
Step 1: Check the current Python version
python -V
![Check the current python version](https://images.laozuo.org/wp-content/uploads/2014/05/python-1.jpg)
We see that the default version is 2.4.3, which does not meet the requirements of the program and needs to be upgraded.
Step 2: Install GCC compiler by yun
yum -y install gcc
Step 3. Download/unzip the Python - 2.7.2 installation package
wget -O Python-2.7.2.tar.bz2 https://www.dropbox.com/s/7ia7obzbsagl3zb/Python-2.7.2.tar.bz2
It is recommended to download manually instead of using wget, because when using wget, the file name will have a hash value. After manual download, it will be uploaded to the root directory
tar -jxvf Python-2.7.2.tar.bz2
Step 4: Enter the Python folder directory
cd Python-2.7.2
Step 5. Installation
./configure make all make install make clean make distclean
Step 6: Check whether the 2.7 version is effective
/usr/local/bin/python2.7 -V
![python-2](https://images.laozuo.org/wp-content/uploads/2014/05/python-2.jpg)
This is not the information of the current version, but to see whether the 2.7 directory has taken effect. The current version is still 2.4.3. We need to use soft connection to convert.
Step 7: Point to python 2.7 by default
mv /usr/bin/python /usr/bin/python2.4 ln -s /usr/local/bin/python2.7 /usr/bin/python
![python-3](https://images.laozuo.org/wp-content/uploads/2014/05/python-3.jpg)
Note that you need to enter a "y" after the first line.
Step 8. Test the current system version
![Python version check](https://images.laozuo.org/wp-content/uploads/2014/05/python-4.jpg)
Step 9. Solve the problem
At present, we need to solve the problem that after pointing to 2.7, yun cannot be used normally.
vi /usr/bin/yum
take
#!/ usr/bin/python
Modify to
#!/ usr/bin/python2.4
![python-6](https://images.laozuo.org/wp-content/uploads/2014/05/python-6.jpg)
So we solved the problem. The steps are a little cumbersome, and Lao Zuo will definitely not copy them. Any article must be tested before sharing, because it can ensure that everyone can use it well.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge