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