简体   繁体   English

Django:如何设置枕头?

[英]Django: How to set up Pillow?

I had my app working with ImageField via Pillow. 我的应用程序通过Pillow与ImageField一起使用。 An unrelated issue set off an update domino chain and now I am stuck trying to get Pillow to work. 一个不相关的问题引发了更新多米诺骨牌链,现在我被困在尝试让枕头工作。

My upgrade to Python 3.6 forced me to upgrade Pillow to version 4, which doesn't seem to work with Django. 我升级到Python 3.6后,我不得不将Pillow升级到版本4,该版本似乎不适用于Django。 When I run a check I get: 运行支票时,我得到:

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

Of course I have already done that. 当然我已经做到了。 I upgraded to Django 1.11, but I am still getting this same error. 我已升级到Django 1.11,但仍然遇到相同的错误。

I tried adding Pillow to my INSTALLED_APPS, but it was not found. 我尝试将枕头添加到我的INSTALLED_APPS中,但找不到。 Besides, I hadn't needed to do that before. 此外,我之前不需要这样做。 How can I troubleshoot this issue? 如何解决此问题?

UPDATE: I printed out a list of modules on my virtual environment and I couldn't find Pillow on the list. 更新:我在虚拟环境中打印出模块列表,但在该列表上找不到Pillow。 However, I can see the files in my env directory. 但是,我可以在我的env目录中看到文件。

All of the other apps that installed in the same environment with the same pip were listed on the modules readout and when I try to install Pillow again, it tells me the requirement is already satisfied. 在模块读数中列出了在相同环境中以相同pip安装的所有其他应用程序,当我再次尝试安装Pillow时,它告诉我该要求已经满足。

I did find an item called pil on the list, but I am not able to uninstall anything called pil or PIL from the env. 我确实在列表上找到了一个名为pil的项目,但是我无法从环境中卸载任何名为pilPIL的项目。

I reinstalled the latest release of Pillow a couple of times to no avail. 我重新安装了最新版本的Pillow,但无济于事。 Rolling back to Pillow==4.0 seemed to solve it. 回滚到Pillow==4.0似乎可以解决。

https://github.com/python-pillow/Pillow/issues/2482 https://github.com/python-pillow/Pillow/issues/2482

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM