Upgrade python2.4 to 2.7.2

Source: Internet
Author: User

[Root @ ~] # Python
 
Python 2.4.3 (#1, May 5 2011, 16:39:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>;>>
[Root @ ~] #
Download a new version of python
[Root @ ~] # Wget
 
Decompress and compile
[Root @ ~] # Tar jxvf Python-2.7.3.tar.bz2
[Root @ wangyuelou Python-2.7.2] #./configure -- prefix =/usr/local/python27
[Root @ wangyuelou Python-2.7.2] # make
[Root @ wangyuelou Python-2.7.2] # make install
[Root @ wangyuelou Python-2.7.2] # ls/usr/local/python27/-al
Total 28
Drwxr-xr-x 6 root 4096 Jul 14 00:21.
Drwxr-xr-x 20 root 4096 Jul 14 00:17 ..
Drwxr-xr-x 2 root 4096 Jul 14 00:21 bin
Drwxr-xr-x 3 root 4096 Jul 14 00:21 include
Drwxr-xr-x 4 root 4096 Jul 14 00:21 lib
Drwxr-xr-x 3 root 4096 Jul 14 00:21 share
Overwrite the original python Link
[Root @ wangyuelou Python-2.7.2] # mv/usr/bin/python/usr/bin/python_old
[Root @ wangyuelou Python-2.7.2] # ln-s/usr/local/python27/bin/python/usr/bin/
[Root @ wangyuelou Python-2.7.2] # python
Python 2.7.2 (default, Jul 14 2011, 00:20:14)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Python2.7 can be used normally.
However, yum is used in version 2.4, so you need to modify it.
[Root @ ~] # Yum
There was a problem importing one of the Python modules
Required to run yum. The error leading to this problem was:
 
No module named yum
 
Please install a package which provides this module, or
Verify that the module is installed correctly.
 
It's possible that the above module doesn't match
Current version of Python, which is:
2.7.2 (default, Jul 14 2011, 00:20:14)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]
 
If you cannot solve this problem yourself, please go
The yum faq:

 
[Root @ wangyuelou Python-2.7.2] # vim/usr/bin/yum
 
#! /Usr/bin/python # modify the location to 2.4
[Root @ ~] # Vim/usr/bin/yum
 
#! /Usr/bin/python2.4
[Root @ ~] # Yum
Loaded plugins: fastestmirror
You need to give some command
Usage: yum [options] COMMAND
 
List of Commands:
 
Check-update Check for available package updates
Clean Remove cached data
Deplist List a package's dependencies
Downgrade a package
Erase Remove a package or packages from your system
Groupinfo Display details about a package group
Groupinstall Install the packages in a group on your system
Grouplist List available package groups
Groupremove Remove the packages in a group from your system
Help Display a helpful usage message
Info Display details about a package or group of packages
Install Install a package or packages on your system
List List a package or groups of packages
Localinstall Install a local RPM
Yum can be used again
 

 

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.