首页 > 解决方案 > Pillow 安装正确,但 Image Field 出错 Pillow is not installed - Django

问题描述

我使用所有这些评论正确安装枕头:Pip install Pillow - Pip Insall Pillow==6.2.0 -

pip install Pillow
Requirement already satisfied: Pillow in c:\program files (x86)\python38-32\lib\site-packages (7.2.0)

python -m pip install --upgrade 枕头

python -m pip install --upgrade Pillow
Requirement already up-to-date: Pillow in c:\program files (x86)\python38-32\lib\site-packages (7.2.0)

并将 Pip 更新为成功,但是当我想像这样添加 ImageField 时image = models.ImageField(),我遇到了这个错误:

eCommerce.Item.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
        HINT: Get Pillow at https://pypi.org/project/Pillow/ or run the command "pip install Pillow".

有人说这是你的 windows 版本,但我为 win64 安装 pip

请帮忙,谢谢

标签: djangopippython-imaging-library

解决方案


假设您使用以下方法调用 manage.py:

python manage.py runserver

python3.7 manage.py runserver

或类似的尝试安装枕头使用

python -m pip install pillow==6.2.0

这会将其安装到目标版本中,请确保替换python为您用于运行 manage.py 的任何命令,例如python3.8或类似命令。

希望这会有所帮助!


推荐阅读