Linux system Installation python2.7

Source: Internet
Author: User

The CentOS6 system comes with a python version of 2.6. Many modules in Python require a Python version of 2.7. This article describes if python2.7 is installed.


1, pre-installation preparation

Install the ReadLine module to provide command history and command completion functions

# yum-y Install ReadLine Readline-devel

ReadLine module:

Http://newcenturycomputers.net/projects/readline.html


Preparation for PIP installation

(python2.7 is usually installed and pip2.7 is installed.) Use python2.7 to install Pip is pip2.7, if you install Pip with python2.6, the PIP version is pip2.6)

Python installation Pip will require the installation of some modules, libraries and other packages, and these packages must be installed in the source code before the installation of Python, or even if the modules will be installed on the error. So to prevent future installation of PIP error, we put the following package also installed on

# yum-y Install zlib-devel# yum-y install OpenSSL openssl-devel


Installing the GCC Compilation tool

#yum-y Install gcc



2. Download the Python installation package

: www.python.org


Installation

#tar zxf python-2.7.11.tgz#cd Python-2.7.11/#./configurer-prefix=/usr/local/python27#make#mak Install


Creating a soft connection

Ln-s/usr/local/python27/bin/python2.7/usr/bin/python2.7# Python2.7python 2.7.11 (default, Jan 9, 10:30:38) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on Linux2type ' help ', ' copyright ', ' credits ' or ' license ' for more information.>> >



Create script in user home directory, write command completion to script


#vim/root/.pythonstartup.py Add the following command to the script

Import ReadLine, Rlcompleter; Readline.parse_and_bind ("Tab:complete")


Create an environment variable and append it to the. bash_profile file in the user's home directory

#vim/root/.bash_profile

Export pythonstartup=~/.pythonstartup.py


Note When the environment variable is modified, re-login is not effective


This article from "Zengestudy" blog, declined reprint!

Linux system Installation python2.7

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.