Python-2.7.11+Django-1.9.4安装配置

时间:2024-09-28 23:36:17

1.去python官网下载2.7的最新版本

https://www.python.org/downloads

1.1 解压Python-2.7.11.tgz

tar xvf Python-2.7.11.tgz

1.2 编译安装

cd Python-2.7.11
./configure --prefix=/usr/local/python-2.7.11
make && make install

1.3 把命令加入环境变量

ln -s /usr/local/python-2.7./bin/python2. /usr/bin/python2.

2.安装 setuptools 20.3.1(两种安装方式)

2.1 下载源码包安装方式

下载地址 https://pypi.python.org/pypi/setuptools#code-of-conduct
tar xvf setuptools-20.3.1.tar.gz
cd setuptools-20.3.1
python2.7 setup.py install

2.2 在线安装方式

wget https://bootstrap.pypa.io/ez_setup.py -O - | python2.7 - --user

3.安装Django-1.9.4

解压
tar xvf Django-1.9.4.tar.gz
安装
cd Django-1.9.4
python2.7 setup.py install

4.测试,导入django模块

python2.7
Python 2.7.11 (default, Mar 23 2016, 11:35:38)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>