【问题标题】:In Django project, Python says Pillow is not installed but it is installed在 Django 项目中,Python 说 Pillow 未安装但已安装
【发布时间】:2021-07-14 08:55:25
【问题描述】:

将 Python 3.8 升级到 3.9 后,出现此错误,提示未安装枕头。我尝试卸载并重新安装枕头,但没有成功。

我在 Windows 10 专业版上使用 Django 3.1。

pip freeze 的输出也附上了。

这是错误信息:

ERRORS:

magazine.Magazine.image: (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".
post.Posts.image: (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".
post.Sample.image: (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".
post.Workers.avatar: (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".
product.Products.image: (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".

【问题讨论】:

  • 你是如何运行 django 的?并且请将所有文本信息添加为文本,而不是图像!
  • 激活venv

标签: python django pycharm windows-10 python-3.9


【解决方案1】:

1.激活虚拟环境(你的环境路径)。\Scripts\activate 2.运行Django应用

这会起作用。

【讨论】:

    【解决方案2】:

    这是警告,因为旧版本的 pip 正在重命名无法删除的文件夹,将第一个字母替换为 tilda ~。

    在您的C:\..\python38-32\lib\site-packages 中有一个名为~illow... 的文件夹。

    当我删除该文件夹并重新安装 python -m pip Pillow 时,它可以工作。

    我有同样的错误,这个post 解决了问题。

    【讨论】:

      猜你喜欢
      • 2015-12-06
      • 1970-01-01
      • 2015-01-05
      • 2012-01-05
      • 2019-05-14
      • 2020-12-02
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      相关资源
      最近更新 更多