One of the Python starter series: CENTOS6 under python2.7 installation

Source: Internet
Author: User

1) Compile and install python2.7

[[email protected] ~]# python -vpython 2.6.6 View Python version information (previous yum was installed by yum) [[Email  protected] src]# wget https://www.python.org/ftp/python/2.7.9/python-2.7.9.tar.xz[[email  protected] src]# file Python-2.7.9.tar.xz Python-2.7.9.tar.xz: xz  Compressed data[[email protected] src]# xz -d python-2.7.9.tar.xz [[email  protected] src]# lsdebug  kernels  python-2.7.9.tar[[email protected]  src]# tar -xf Python-2.7.9.tar [[email protected] src]# cd  python-2.7.9[[email protected] python-2.7.9]# ./configure [[email protected]  python-2.7.9]# make && make install[[email protected] python-2.7.9]#  echo $?0[[email protected] python-2.7.9]# /usr/local/bin/python2.7 -vpython  2.7.9[[email protected] pYTHON-2.7.9]# MV /USR/BIN/PYTHON /USR/BIN/PYTHON2.6MV: Do you want to overwrite "/usr/bin/python2.6"?  yes[[email protected] python-2.7.9]# ln -s /usr/local/bin/python2.7 /usr/ bin/python[[email protected] python-2.7.9]# python -vpython 2.7.9

2) Adjust the configuration of Yum

Because Yum uses the information that calls Python, avoids reinstalling Python, yum error, edit yum file: [[email protected] python-2.7.9]# sed - i  ' [email protected]#!/usr/bin/[email protected]#!/usr/bin/[email protected] '  /usr/ bin/yum[[email protected] python-2.7.9]# cat /usr/bin/yum |head#!/usr/bin/ python2.6import systry:    import yumexcept 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[[email protected] 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 information.>>> print  "Hello,world" Hello,world to this, python2.7 's basic installation has also been completed. 


This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1873670

One of the Python starter series: CENTOS6 under python2.7 installation

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.