First, prepare the installation environment
System: CentOS 6.5
Kernel:
[Email protected] ~]# uname-r
2.6.32-431.el6.x86_64
Second, download the appropriate package
Python:wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Setuptools:wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5= 7df2a529a074f613b509fb44feefe74e
Third, start the actual installation
1) Create the installation directory and put the downloaded package in this directory
[[email protected]/]# mkdir python
[email protected] python]# LL
Total 14068
-rw-r--r--1 root root 14135620 Apr python-2.7.3.tgz
-rw-r--r--1 root root 256862 Nov 08:40 setuptools-0.6c11.tar.gz
[Email protected] python]# TAR-ZXVF python-2.7.3.tgz
[[email protected] python]# ls
Python-2.7.3 python-2.7.3.tgz
2) Install the Zlib,zlib-devel package required for compilation (if not installed, the following error occurs
[[email protected] python] #yum-y install zlib zlib-devel
Note: If not installed, the following error occurs
File "/usr/local/lib/python2.7/zipfile.py", line 681, in __init__
"Compression requires the (missing) zlib module"
Runtimeerror:compression requires the (missing) zlib module
3). Configure the installation path
[Email protected] python-2.7.3]#/configure--prefix=/usr/local/python-2.7.3
4). Compiling and installing
[[email protected] python-2.7.3]# make
[[email protected] python-2.7.3]# make install
5). Configure Soft Links
[Email protected]/]# ln-s/usr/local/python-2.7.3/bin/python/bin/python-2.7.3
[Email protected] python]# python-2.7.3
Python 2.7.3 (Default, Nov 26 2015, 08:51:08)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>>
6). Download and install Setuptools
[Email protected] python]# TAR-ZXVF setuptools-0.6c11.tar.gz
[Email protected] python]# CD SETUPTOOLS-0.6C11
[Email protected] setuptools-0.6c11]# python-2.7.3 setup.py Build
[[email protected] setuptools-0.6c11]# python-2.7.3 setup.py Install (This step is critical, if there is a problem, go back to step 2) installing the dependency package, recompile and install Python)
[Email protected] bin]# ln-s/usr/local/python-2.7.3/bin/easy_install/bin/easy_install-2.7.3
7) Install the corresponding library using Easy_install
[[email protected] setuptools-0.6c11]# easy_install-2.7.3 Django
This article is from the "intentions to create value, late coffee" blog, please be sure to keep this source http://wandiankafei.blog.51cto.com/10878910/1716959
A detailed tutorial on installing Python under CentOS