Python 通过pip安装Django详细介绍

时间:2022-10-10 08:55:08

Python 通过pip安装Django详细介绍

经过前面的 Python 包管理工具的学习,接下来我们就要基于前面的知识,来配置 Django 的开发与运行环境。

首先是安装 Django(通过pip安装):

?
1
pip install Django

输出的结果在我这里是这样的:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Downloading/unpacking Django
 Downloading Django-1.5.2.tar.gz (8.0MB): 8.0MB downloaded
 Running setup.py egg_info for package Django
 
  warning: no previously-included files matching '__pycache__' found under directory '*'
  warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: Django
 Running setup.py install for Django
  changing mode of build/scripts-2.7/django-admin.py from 644 to 755
 
  warning: no previously-included files matching '__pycache__' found under directory '*'
  warning: no previously-included files matching '*.py[co]' found under directory '*'
  changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed Django
Cleaning up...

验证一下Django是否成功安装:

?
1
2
3
4
5
6
[root@nowamagic ~]# python2.7
Python 2.7.5 (default, Sep 2 2013, 15:56:04)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>

import 成功,也就是 Django 已经安装成功。

现在你去 /usr/local/bin/ 中,也可以看到对应的 django-admin.py 了,这样就可以使用 django-admin.py 创建项目。

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

原文链接:http://www.nowamagic.net/academy/detail/1330404