在centos上安装django,应该有3种方法,pip、git、源代码编译安装。

pip安装比较单,步骤如下:

1、下载

mkdir /install/django

cd /install/django

wget

--2015-06-25 11:29:12--  https://bootstrap.pypa.io/get-pip.py

Resolving bootstrap.pypa.io... 103.245.222.175

Connecting to bootstrap.pypa.io|103.245.222.175|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1421845 (1.4M) [text/x-python]

Saving to: “get-pip.py”

100%[===================================================================================>] 1,421,845   21.4K/s   in 74s     

2015-06-25 11:30:30 (18.7 KB/s) - “get-pip.py” saved [1421845/1421845]

2、get-pip安装

python get-pip.py

For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

  Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB)

    100% |████████████████████████████████| 1.1MB 19kB/s 

Collecting setuptools

  Downloading setuptools-18.0.1-py2.py3-none-any.whl (461kB)

    100% |████████████████████████████████| 462kB 30kB/s 

Collecting wheel

  Downloading wheel-0.24.0-py2.py3-none-any.whl (63kB)

    100% |████████████████████████████████| 65kB 15kB/s 

Collecting argparse (from wheel)

  Downloading argparse-1.3.0-py2.py3-none-any.whl

Installing collected packages: pip, setuptools, argparse, wheel

Successfully installed argparse-1.3.0 pip-7.0.3 setuptools-18.0.1 wheel-0.24.0

3、pip安装django

pip install Django==1.6

Collecting Django==1.6

/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

  InsecurePlatformWarning

  Downloading Django-1.6-py2.py3-none-any.whl (6.7MB)

    100% |████████████████████████████████| 6.7MB 7.8kB/s 

Installing collected packages: Django

  Found existing installation: Django 1.8.2

    Uninstalling Django-1.8.2:

      Successfully uninstalled Django-1.8.2

Successfully installed Django-1.6

如果先下载过别的版本,这里就会出现清理的信息。这里就是清理以前安装过的1.8.2版本。

4、验证一下版本

python -c "import django; print(django.get_version())"

1.6