当我尝试在 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)