如题所述
关于Pillow与PIL
PIL(Python Imaging Library)是Python一个强大方便的图像处理库,名气也比较大。不过只支持到Python 2.7。
PIL官方网站:http://www.pythonware.com/products/pil/
Pillow是PIL的一个派生分支,但如今已经发展成为比PIL本身更具活力的图像处理库。目前最新版本是3.0.0。
Pillow的Github主页:https://github.com/python-pillow/Pillow
Pillow的文档(对应版本v3.0.0):https://pillow.readthedocs.org/en/latest/handbook/index.html
Pillow的文档中文翻译(对应版本v2.4.0):http://pillow-cn.readthedocs.org/en/latest/
Python 3.x 安装Pillow
给Python安装Pillow非常简单,使用pip或easy_install只要一行代码即可。
在命令行使用PIP安装:
pip install Pillow
或在命令行使用easy_install安装:
easy_install Pillow
安装完成后,使用from PIL import Image就引用使用库了。比如:
from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
PIL(Python Imaging Library)是Python一个强大方便的图像处理库,名气也比较大。不过只支持到Python 2.7。
PIL官方网站:http://www.pythonware.com/products/pil/
Pillow是PIL的一个派生分支,但如今已经发展成为比PIL本身更具活力的图像处理库。目前最新版本是3.0.0。
Pillow的Github主页:https://github.com/python-pillow/Pillow
Pillow的文档(对应版本v3.0.0):https://pillow.readthedocs.org/en/latest/handbook/index.html
Pillow的文档中文翻译(对应版本v2.4.0):http://pillow-cn.readthedocs.org/en/latest/
Python 3.x 安装Pillow
给Python安装Pillow非常简单,使用pip或easy_install只要一行代码即可。
在命令行使用PIP安装:
pip install Pillow
或在命令行使用easy_install安装:
easy_install Pillow
安装完成后,使用from PIL import Image就引用使用库了。比如:
from PIL import Image
im = Image.open("bride.jpg")
im.rotate(45).show()
温馨提示:答案为网友推荐,仅供参考
第1个回答 2017-10-23
Mac OSX
brew update
brew install libjpeg libpng
装这两个就够了
Ubuntu 14.0.4
sudo apt-get install libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev
Linux 上比较惨一些,要多装几个包.
这还不够的, 最好就直接用 Pillow 这个 python 包来取代手工下载 Imaging 这个包吧,直接用以下指令
pip install -I --no-cache-dir -v Pillow
这个指令执行完毕会有一大堆的信息,不用管它,只要找到以下这个就行了:
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 3.2.0
platform linux2 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBTIFF support not available
--- FREETYPE2 support available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
brew update
brew install libjpeg libpng
装这两个就够了
Ubuntu 14.0.4
sudo apt-get install libjpeg-dev libpng12-dev libfreetype6-dev libtiff-dev
Linux 上比较惨一些,要多装几个包.
这还不够的, 最好就直接用 Pillow 这个 python 包来取代手工下载 Imaging 这个包吧,直接用以下指令
pip install -I --no-cache-dir -v Pillow
这个指令执行完毕会有一大堆的信息,不用管它,只要找到以下这个就行了:
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 3.2.0
platform linux2 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBTIFF support not available
--- FREETYPE2 support available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
第2个回答 2017-10-23
命令行窗口键入(假设我下载的PIL文件存放在E盘下,文件名叫Pillow-3.3.1-cp27-cp27m-win_amd64.whl)
pip install e:\Pillow-3.3.1-cp27-cp27m-win_amd64.whl安装完毕,需要检查一下安装是否成功。
本回答被提问者采纳