gpt4 book ai didi

python - Django SystemCheckError 说 Pillow 未安装,但 Pillow 已安装

转载 作者:行者123 更新时间:2023-12-04 18:34:18 26 4
gpt4 key购买 nike

当我运行 python manage.py runserver ,一切开始都很好,但后来我得到一个 SystemCheckError说明 Pillow 未安装;但是,这台机器上肯定安装了 Pillow。

这是我收到的错误:

Performing system checks...

Unhandled exception in thread started by Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 110, in inner_run self.validate(display_num_errors=True) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 468, in validate return self.check(app_configs=app_configs, display_num_errors=display_num_errors) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 527, in check raise SystemCheckError(msg) django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS: recipes.Recipes.primary_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow". recipes.Recipes.thumbnail_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".



我在 Ubuntu 机器上运行它。有什么想法吗?

最佳答案

在您的代码中,如果您曾在任何地方尝试使用导入语句,如 import pillowfrom pillow import ... ,将这些语句更改为:

from PIL import ...

或者
import PIL

PIL 即不再维护 Python 图像库, Pillow 改为使用。为了保持向后兼容性, PIL模块名称用于导入。

关于python - Django SystemCheckError 说 Pillow 未安装,但 Pillow 已安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32492183/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com