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.