Linux Source Installation Python

Source: Internet
Author: User

Download the source tar package

:https://www.python.org/downloads/

I download the python-2.7.11.tgz here

# TAR-ZXVF Python-2.7.11.tgz


Go to the Unpacked folder


# CD Python-2.7.11

Build a folder in/usr/local before compiling python2 (as a Python installation path to avoid overwriting the old version)


# Mkdir/usr/local/python2

Start compiling the installation

#./configure--prefix=/usr/local/python2# make# make install

  

Move the previous version

# Mv/usr/bin/python/usr/bin/python_old

 

Link to build a new version of Python

Ln-s/usr/local/python2/bin/python/usr/bin/python

  

This time input

# Pythonpython 2.7.11 (default, Feb, 18:01:00) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on Linux2type "help", "Copyr Ight "," credits "or" license "for more information.>>>


Complete


As the new version of Python is affected by the use of Yum, the situation is as follows

# yum grouplistthere was a problem  importing one of the python modulesrequired to run yum. the  error leading to this problem was:   no module named  yumplease install a package which provides this module, orverify  that the module is installed correctly. It ' S POSSIBLE THAT THE ABOVE MODULE DOESN ' t match thecurrent  version of python, which is:2.7.11  (default, feb 19 2016,  18:01:00)  [GCC 4.8.5 20150623  (red hat 4.8.5-4)]if you cannot  Solve this problem yourself, please go to the yum faq at:   http://yum.baseurl.org/wiki/faq 

Python version does not match, we modify Yum as the old version of Python just


View the original Python location

# Whereis Pythonpython:/usr/bin/python2.7/usr/bin/python/usr/lib/python2.7/usr/lib64/python2.7/usr/include/ Python2.7/usr/share/man/man1/python.1.gz
# Vim/usr/bin/yum

Modify the first line#!/usr/bin/pythonFor#!/usr/bin/python2.7


OK. Complete

This article is from the "Home_tang" blog, make sure to keep this source http://yagetang.blog.51cto.com/1780698/1743501

Linux Source Installation python

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.