Python2.7 Installation Tutorials

Source: Internet
Author: User

  Zhanhailiang Date: 2014-11-16
[Root@~/Software]# yum Install bzip*[Root@~/Software]# wget Http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz[Root@~/Software]# tar zxvf python-2.7.3.tgz[Root@~/Software]# CD Python-2.7.3[Root@~/Software/Python-2.7.3]#./configure[Root@~/Software/Python-2.7.3]# make && make install[Root@~/Software]# cd/usr/local/bin/[Root@/Usr/Local/Bin]# Ls-al python*lrwxrwxrwx1Root root7Nov -  -: -Python->Python2lrwxrwxrwx1Root root9Nov -  -: -Python2->python2.7-rwxr-xr-x 1Root root6162217Nov -  -: atpython2.7-rwxr-xr-x 1Root root1624Nov -  -: -Python2.7-configlrwxrwxrwx1Root root -Nov -  -: -Python2-config->Python2.7-configlrwxrwxrwx1Root root -Nov -  -: -Python-config->Python2-config[Root@/Usr/Local/Bin]#/usr/local/bin/python-vPython 2.7.3

So the installation is complete. But because some software, such as node. js, relies on python2.7, you need to modify the system path at this point. python command points to 2.7. Version 3:

[Root@/Usr/Local/Bin]# cp/usr/bin/python/usr/bin/python.bak.2014.11.16[Root@/Usr/Local/Bin]# Rm/usr/bin/python[Root@/Usr/Local/Bin]# ln-s/usr/local/bin/python2.7/usr/bin/python

So, if you encounter yum problems, the following "there was a problem importingone of the Python modules":

[Root@~/Software/Python-2.7.3]# Yum Search bZIPThere is a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was:No module namedYum pleaseInstalla Packagewhichprovides this module, orverify the module is installed correctly. It' s possible that the above module doesn 'T match thecurrent version of Python,whichis:2.7.3(default, Nov -  the,  -: A: $) [GCC 4.4.720120313 (Red Hat 4.4.7-4)]If You cannot solve this problem yourself and go to theYumFAQ at:http://yum.baseurl.org/Wiki/Faq

This is because Yum relies on older versions of Python, which can be fixed as follows:

[root@~/software/Python-2.7.3] # Vim/usr/bin/yum

Modify the first line of the command line to point Python to the specified version:

  1 #!/usr/bin/python2.6  2Import SYS3Try:4ImportYum

Reference article: Http://www.tomtalk.net/wiki/Python

Python2.7 Installation Tutorials

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.