【发布时间】:2021-08-27 01:10:09
【问题描述】:
您好,我一直在尝试为我的 Django 应用程序中的一个模型添加 ImageField。 当我运行以下代码时:
python3 manage.py makemigrations
一个声明出来了,说我需要安装 Pillow,我照做了('Successfully installed Pillow-8.2.0')。
但是,当我再次尝试运行 makemigrations 时,出现以下错误:
(fields.E210) Cannot use ImageField because Pillow is not installed.
HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
我知道那里有几个讨论过类似问题的线程(例如python/django - "Cannot use ImageField because Pillow is not installed"),我已经尝试做任何推荐的事情(重新安装 64 位 Python,升级 pip,确保我没有 PIL ,尝试安装较旧的 Pillow 版本)但没有成功。
特别是,尝试安装较旧的 Pillow 版本会导致错误并显示以下消息:
Pillow 7.1.0 does not support Python 3.9 and does not provide prebuilt Windows binaries.
我正在使用 Windows 10、Python 3.9、Django 3.2.0 和 Pillow 8.2.0。如果有人能帮我解决这个问题,我将不胜感激,谢谢!
【问题讨论】:
标签: python django django-models pip python-imaging-library