本文介绍了在Django项目中,Python表示未安装Pillow但已安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Python 3.8升级到3.9后,发生此错误,并说未安装枕头.我试图卸载并重新安装枕头,但没有成功.

After upgrading Python 3.8 to 3.9 this error has happened and says pillow is not installed. I tried to uninstall and reinstall pillow, but it did not worked.

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

I'm using Django 3.1 on a Windows 10 pro.

pip Frozen 的输出也已附加.

这是错误消息:

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".

推荐答案

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

It's warning because old version of pip was renaming folders that it could not delete, replacing first letter with tilda ~.

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

In your C:\..\python38-32\lib\site-packages have a folder named ~illow....

当我删除该文件夹并重新安装 python -m pip Pillow 时,它就起作用了.

When I delete that folder and reinstall python -m pip Pillow, it's worked.

我有相同的错误,此帖子解决了问题.

I have same error and this post solved problem.

这篇关于在Django项目中,Python表示未安装Pillow但已安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 15:06