Python: install python2.7 in Centos6

Source: Internet
Author: User
Python: install python2.7 in Centos6. 1) compile and install python2.7.

[Root @ mysql-master ~] # Python-VPython 2.6.6 view python version information (the previous yum was installed through yum) [root @ mysql-master src] # wget ‑src] # file Python-2.7.9.tar.xz Python-2.7.9.tar.xz: xz compressed data [root @ mysql-master src] # xz-d Python-2.7.9.tar.xz [root @ mysql-master src] # lsdebug kernels Python-2.7.9.tar [root @ mysql-master src] # tar-xf python-2.7.9.tar [root @ mysql- Master src] # cd Python-2.7.9 [root @ mysql-master Python-2.7.9] #. /configure [root @ mysql-master Python-2.7.9] # make & make install [root @ mysql-master Python-2.7.9] # echo $? 0 [root @ mysql-master Python-2.7.9] #/usr/local/bin/python2.7-VPython 2.7.9 [root @ mysql-master Python-2.7.9] # mv/usr/bin/ python/usr/bin/python2.6mv: overwrite "/usr/bin/python2.6 "? Yes [root @ mysql-master Python-2.7.9] # ln-s/usr/local/bin/python2.7/usr/bin/python [root @ mysql-master Python-2.7.9] # python-VPython 2.7.9

2) adjust the yum configuration

Because yum will call python information to avoid yum errors after python is re-installed. edit the yum file: [root @ mysql-master Python-2.7.9] # sed-I's @#! /Usr/bin/python @#! /Usr/bin/python2.6 @ g'/usr/bin/yum [root @ mysql-master Python-2.7.9] # cat/usr/bin/yum | head #! /Usr/bin/python2.6import systry: import yumstmt ImportError: print> sys. stderr, "" \ There was a problem importing one of the Python modulesrequired to run yum. the error leading to this problem was: % s [root @ mysql-master Python-2.7.9] # pythonPython 2.7.9 (default, Nov 16 2016, 19:53:47) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2Type "help", "copyright", "credits" or "license" for more inf Ormation. >>> print "hello, world" hello, world at this point, the basic installation of python2.7 is complete.

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.