Python 通过pip安装Django详细介绍

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

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

pip installDjango

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

Downloading/unpacking Django Downloading Django-1.5.2.tar.gz (8.0MB): 8.0MBdownloaded Running setup.py egg_info forpackage 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 forDjango  changing mode of build/scripts-2.7/django-admin.py from644to 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 755Successfully installed DjangoCleaning up...

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

[root@nowamagic ~]# python2.7Python 2.7.5(default, Sep 22013, 15:56:04)[GCC 4.1.220080704(Red Hat 4.1.2-54)] on linux2Type"help", "copyright", "credits"or"license"formore information.>>> importdjango>>>

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

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

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

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