django

ImportError: No module named zlib 오류 해결 방법

가는가래 2013. 5. 11. 00:49

django 프로젝트 생성 명령어 실행시 아래와 같은 오류가 나는 경우 python 설치시에 zlib, zlib-devel 라이브리가 설치가 안되어 있을 경우 python에 해당 모듈이 생성이 되지 않아서 발생한다.

해결방법
1. yum install zlib, zlib-devel
2. => python 재설치

$django-admin.py startproject mysite
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