pip、PIL 和 Pillow

标签 pip virtualenv python-imaging-library django-hvad

我运行了以下命令将项目依赖项安装到 virtualenv novacek 中:

(novacek) $ pip install -r reqs.txt

reqs.txt 看起来像这样:

Django==1.4.4
Pillow==1.7.8
South==0.7.6
django-bootstrap-toolkit==2.8.0
django-debug-toolbar==0.9.4
django-filebrowser==3.5.1
-e git+https://github.com/ir4y/django-flatblocks.git@4f8b2c86fe94e19dc7aa86b80a204918e2142aff#egg=django_flatblocks-dev
django-generic-flatblocks==0.9.1
django-grappelli==2.4.3
django-hvad==0.2
django-photologue==2.5
docutils==0.10
psycopg2==2.4.6
wsgiref==0.1.2

如您所见,没有 PIL 包,只有 Pillow,但在安装过程的最后我得到了这个:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.3 (default, Feb 21 2013, 13:39:24)
              [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------

这很奇怪。我之前还获得了 Pillow 的设置摘要(顺便说一句,启用了对 jpeg 和 zlib 的支持。因为 Pillow 实际上可以找到我的库)。

如果我在安装后从 virtualenv 运行 pip freeze,我会得到这个:

Django==1.4.4
PIL==1.1.7
Pillow==1.7.8
South==0.7.6
django-bootstrap-toolkit==2.8.0
django-debug-toolbar==0.9.4
django-filebrowser==3.5.1
-e git+https://github.com/ir4y/django-flatblocks.git@4f8b2c86fe94e19dc7aa86b80a204918e2142aff#egg=django_flatblocks-dev
django-generic-flatblocks==0.9.1
django-grappelli==2.4.3
django-hvad==0.2
django-photologue==2.5
docutils==0.10
psycopg2==2.4.6
wsgiref==0.1.2

PIL 已陷入依赖关系。为什么?

最佳答案

这是完全正确的。 Pillow 是一个 fork ,PIL 的替代重新包装。

来自PyPI page for Pillow :

The fork author's goal is to foster packaging improvements via:

  • Publicized development and solicitation of community support.
  • Exploration of packaging problems within the fork, most noticably via adding setuptools support but also via clean up & refactoring of packaging code.

在包内,这仍然是 PIL 项目,并且在编译时仍会以该名称发出消息。

不幸的是,Pillow 并未声称满足 PIL 要求,因此任何依赖 PIL 的东西仍然会引入 PIL。

关于pip、PIL 和 Pillow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15141823/

相关文章:

python - pip install 在写入 installed-files.txt 时遗漏了一些生成的文件

python - pip 的操作系统特定要求

docker - 无法从 docker build 中的工件注册表安装私有(private)依赖项

python - 在 Windows 7 64 位 PC 上安装 PIL

python - 将 Base64 字符串加载到 Python 图像库中

python - 由于环境错误 : [Errno 2] No Such file or directory,无法安装软件包

python - 皮林特 : "Problem importing module ....: cannot import name ' Type'"

python - 如何将 Python 3.6 设置为 Zappa 的默认版本?

Windows : ImportError: No module named 'pip' 上的 Python 3.3.4 和 virtualenv 创建

python 图像识别