【发布时间】:2012-10-12 16:32:34
【问题描述】:
我第一次安装 Django(并使用 python)。我运行 Mac OSX 10.8 Mountain Lion,默认情况下,python 已经安装:
$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
我已按照https://docs.djangoproject.com/en/1.4/intro/install/ 的步骤进行操作,即:
在https://www.djangoproject.com/download/ 下载 Django 并运行以下命令:
$ tar xzvf Django-1.4.1.tar.gz
$ cd Django-1.4.1
$ sudo python setup.py install
这在 /user/local/bin 中创建了一个符号链接,它允许我使用 $ django-admin.py 从任何地方调用 Django
但是,尝试以下失败:
$ python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
我应该在输入 >>> import django 后得到一些东西
>>> print django.get_version()
1.4
是我遗漏了什么还是文档不那么准确?
【问题讨论】:
-
期待
import django做什么?这是正确的行为。
标签: django