1.下载Python-2.7.3
[plain] view plain copy
#wgethttp://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
2.解压
[plain] view plain copy
#tar -jxvf Python-2.7.3.tar.bz2
3.更改工作目录
[plain] view plain copy
#cd Python-2.7.3
4.安装
[plain] view plain copy
#./configure
#编辑Modules/Setup文件,找到下面这句,去掉注释 zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
#make all
#make install
#make clean
#make distclean
5.查看版本信息
[plain] view plain copy
#/usr/local/bin/python2.7 -V
6.建立软连接,使系统默认的 python指向 python2.7
[plain] view plain copy
#mv /usr/bin/python /usr/bin/python2.6.6
#ln -s /usr/local/bin/python2.7 /usr/bin/python
7.重新检验Python 版本
[plain] view plain copy
#python -V
8解决系统 Python 软链接指向 Python2.7 版本后,因为yum是不兼容 Python 2.7的,所以yum不能正常工作,我们需要指定 yum 的Python版本
[plain] view plain copy
#vi /usr/bin/yum
将文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6
9、下载settuptool
1、wgethttps://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea--no-check-certificate
2、安装
bash setuptools-0.6c11-py2.7.egg
10、下载pip
1、wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
2、tar -xzvf pip-1.5.4.tar.gz;cd Pip
3、python setup.py install
11、安装MysqLdb模块
yum -y install MysqL-python
apt-get install python-MysqLdb
12、安装django
pip install Django
原文链接:https://www.f2er.com/centos/378901.html