Cla*_*MBE 6 python python-imaging-library pillow
我想在Mac OS X计算机上安装PIL(Python Imaging Library)版本.我之前已经安装了Pillow,一个更友好的PIL分支.
我试过了:
import PIL
print('PIL',PIL.__version__)
Run Code Online (Sandbox Code Playgroud)
我有错误:
AttributeError: module 'PIL' has no attribute '__version__'
Run Code Online (Sandbox Code Playgroud)
要获得PIL的版本
>>> PIL.VERSION
'1.1.7'
Run Code Online (Sandbox Code Playgroud)
这只给你PIL版本而不是Pillow版本.有关详细信息,请参阅此答案.
使用PIL.__version__。
在Pillow 6.0.0版之前,可以通过以下变量名称访问其版本字符串:
>>> PIL.version.__version__
'5.1.0'
>>> PIL.PILLOW_VERSION
'5.1.0'
>>> PIL.__version__
'5.1.0'
>>>
Run Code Online (Sandbox Code Playgroud)
不要与Pillow构建(并因此挂起)的最新PIL版本相混淆:
>>> PIL.VERSION
'1.1.7'
Run Code Online (Sandbox Code Playgroud)
在文档中没有有关PIL派生的信息:https : //pillow.readthedocs.io/zh/5.1.x/about.html#why-a-fork
但是,PIL的首页上注明
状态
当前的免费版本是PIL 1.1.7。此版本支持Python 1.5.2及更高版本,包括2.5和2.6。3.X的版本将在以后发布。
该版本的发布日期为“ 2009年11月15日”。
这确认这只是PIL的最新发行版本。
版本字符串在以下源文件中定义:https://github.com/python-pillow/Pillow/blob/master/src/PIL/version.py和https://github.com/python-pillow/Pillow/blob/master/src/PIL/__init__.py,或在存储库中搜索所有__version__出现的。
(在我的Windows上,这已安装到%LocalAppData%\Programs\Python\Python36\Lib\site-packages\PIL\version.py)
https://pillow.readthedocs.io/zh-CN/stable/releasenotes/5.2.0.html
5.2.0 API更改弃用
这些版本常量已被弃用。
VERSION将在Pillow 6.0.0PILLOW_VERSION中删除,此后将被删除。Run Code Online (Sandbox Code Playgroud)`PIL.VERSION` (old PIL version 1.1.7) `PIL.PILLOW_VERSION` `PIL.Image.VERSION` `PIL.Image.PILLOW_VERSION`使用
PIL.__version__代替。
https://pillow.readthedocs.io/zh-CN/stable/releasenotes/6.0.0.html
6.0.0向后不兼容的更改
删除了不推荐使用的VERSION
VERSION(旧的PIL版本,始终为1.1.7)已被删除。使用__version__代替。