0
我有一個django(1.5.1)項目。這個項目是用PIL構建的。現在點子只使用枕頭。 我運行了我的virtualenv,cd到項目文件夾,安裝了所有需求(PIL被更改爲Pillow)並且堆積有問題。將現有項目從PIL導入枕頭
>>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)
看來你正在回答你自己的問題:'這個項目是用PIL構建的。現在pip只使用Pillow.'(並且錯誤非常簡單:'沒有名爲Image的模塊) – achedeuzot 2014-09-21 17:23:45
您的代碼中某處使用了「import Image」 - 用於使用PIL,但是當您使用枕頭,你必須做「從PIL導入圖像」,否則你會得到你所得到的一個ImportError。 – kchan 2014-09-21 17:26:26
@achedeuzot好的。這是否意味着我應該安裝Pil? – andrewkslv 2014-09-21 17:35:51