如何使用Elementary os在Django上创建项目?

时间:2013-07-25 02:14:28

标签: python django linux

当我尝试在Django上创建项目时,我遇到了麻烦。

错误讯息:

django-admin.py startproject car

Traceback (most recent call last):

  File "/usr/local/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()

  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line


    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute


    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command

    klass = load_command_class(app_name, subcommand)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module

    __import__(name)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/startproject.py", line 2, in <module>
    from django.core.management.templates import TemplateCommand
  File "/usr/local/lib/python2.7/site-packages/django/core/management/templates.py", line 20, in <module>


    from django.template import Template, Context
  File "/usr/local/lib/python2.7/site-packages/django/template/__init__.py", line 53, in <module>


    from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
  File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 12, in <module>

    from django.utils.text import (smart_split, unescape_string_literal,
  File "/usr/local/lib/python2.7/site-packages/django/utils/text.py", line 6, in <module>
    from gzip import GzipFile

  File "/usr/local/lib/python2.7/gzip.py", line 9, in <module>

    import zlib
ImportError: No module named zlib

(我已经安装了Python 2.7和Django 1.5.1)

1 个答案:

答案 0 :(得分:0)

你应该更仔细地阅读你的错误。

ImportError: No module named zlib