将现有项目从PIL导入Pillow

时间:2014-09-21 17:13:35

标签: python django python-imaging-library pillow

我有一个django(1.5.1)项目。该项目是用PIL构建的。现在pip只使用Pillow。 我运行了我的virtualenv,cd到项目文件夹,安装了所有要求(PIL更改为Pillow)并堆积有问题。

 >>python manage.py syncdb 
No local settings
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/watashi/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
  File "/home/watashi/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/watashi/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/watashi/venv/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 "/home/watashi/venv/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/watashi/venv/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
    import django.template.loaders.app_directories
  File "/home/watashi/venv/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in <module>
    raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError utils: No module named Image

为了解决这个问题,我还尝试了this教程,但它没有帮助。怎么了?如何理解这个问题?

其他信息:

manage.py脚本

#!/usr/bin/env python
import os
import sys


if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

    from django.core.management import execute_from_command_line

    execute_from_command_line(sys.argv)

1 个答案:

答案 0 :(得分:0)

可以使用以下命令修复此问题

pip install --upgrade setuptools