ÐÂÕÒÒ»·Ý×öpython¿ª·¢µÄ¹¤×÷£¬ÐèÒª´ÓÍ·¿ªÊ¼Ñ§Ï°python¡£
ÔÚ¹¤×÷»·¾³ÖÐʹÓõÄÊÇpython 2.7.*£¬µ«ÊÇCentOS 6.4ÖÐĬÈÏʹÓõÄpython°æ±¾ÊÇ2.6.6£¬¹ÊÐèÒªÉý¼¶°æ±¾¡£
°²×°²½ÖèÈçÏ£º
1,ÏȰ²×°GCC£¬ÓÃÈçÏÂÃüÁîyum install gcc gcc-c++
2,ÏÂÔØpython-2.7.5.tar.gzÎļþ£¬ÐÞ¸ÄÎļþȨÏÞchmode +x python-7.5.tar.gz
3,½âѹtarÎļþ£¬tar -xzvf python-2.7.5.tar.gz
4,cd python-2.7.5
./configure --prefix=/usr/local/python27 ### ×¢Ò⣺°²×°ÔÚÐÂĿ¼£¬·ÀÖ¹¸²¸ÇϵͳĬÈϰ²×°µÄpython
make && make install
5¡¢½¨Á¢ÈíÁ¬½Ó£¬Ê¹ÏµÍ³Ä¬ÈϵÄpythonÖ¸Ïòpython27
mv /usr/bin/python /usr/bin/python2.6.6.old
ln -s /usr/local/bin/python27 /usr/bin/python
ÒѾ°²×°Íê³ÉpythonµÄ°²×°»òÉý¼¶µÄÈ«²¿²Ù×÷ÁË£¬ÎÒÃÇÔÙÀ´¿´Ò»ÏÂÏÖÔÚµÄpythonµÄ°æ±¾£º
# python -V
Python 2.7.5
ËäÈ»ÏÖÔÚpythonÒѾ°²×°Íê³É£¬µ«ÊÇʹÓÃyumÃüÁî»áÓÐÎÊÌâ----yum²»ÄÜÕý³£¹¤×÷£º
# yum list
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 the
current version of Python
ÕâÊÇÒòΪyumĬÈÏʹÓõÄpython°æ±¾ÊÇ2.6.6£¬µ½ÄÄÊÇÏÖÔÚµÄpython°æ±¾ÊÇ2.7.5£¬¹Ê»á³öÏÖÉÏÊöÎÊÌ⣬ֻÐèÒª¸ÃÒ»ÏÂyumµÄĬÈÏpythonÅäÖð汾¾ÍÐÐÁË£º
#vi /usr/bin/yum
½«ÎļþÍ·²¿µÄ#!/usr/bin/python¸ÄΪ
#!/usr/bin/python2.6
×÷Õߣºflyingdutchman

