安装

警告

Pillow >= 2.1.0 不支持 “import _imaging”。请使用 “from PIL.Image import core as _imaging” 代替。

警告

Pillow >= 1.0 不支持 “import Image”. 请使用 “from PIL import Image” 代替。

警告

PIL 和 Pillow 现在不能共存。 如果你想使用 Pillow, 请首先移除 PIL 。

注解

Pillow >= 2.0.0 支持 Python 版本 2.6, 2.7, 3.2, 3.3, 3.4

注解

Pillow < 2.0.0 支持 Python 版本 2.4, 2.5, 2.6, 2.7.

简单安装

注解

下面的指南将会安装支持大多数格式的 Pillow。 查看 外部库 了解安装外部库的信息。这个页面包含了特定平台的安装。

你可以使用 pip 命令安装Pillow:

$ pip install Pillow

或者 easy_install (for installing Python Eggs, as pip does not support them):

$ easy_install Pillow

或者从 PyPI 下载 compressed archive from PyPI ,解压,进入目录运行:

$ python setup.py install

外部库

Pillow 的许多功能需要外部库的支持:

  • libjpeg 提供 JPEG 相关功能

    • Pillow 已经在这些版本测试过:versions 6b, 8, and 9
  • zlib 提供压缩 PNG 功能
  • libtiff 提供 group4 tiff 功能
    • Pillow 已经在这些版本测试过:versions 3.x and 4.0
  • libfreetype 提供类型相关服务
  • littlecms provides color management
    • Pillow 2.2.1 以及更低版本使用 liblcms1, Pillow 2.3.0 以及更高版本使用 liblcms2. 在这些版本测试通过: 1.19 and 2.2
  • libwebp 提供 webp 相关功能
    • Pillow已经在这些版本测试过: version 0.1.3 不能读取透明webp图像, Versions 0.3.0 and0.4.0 支持透明。
  • tcl/tk 提供 tkinter bitmap and photo images 的支持
  • openjpeg 提供 JPEG 2000 功能
    • Pillow 在这些版本测试通过: 2.0.0

如果机器上已经使用标准方法在标准目录安装了这些库 (e.g. /usr or /usr/local), 那么不需要进行多余的配置了。如果它们安装在非标准目录,你可能需要配置 setuptools 以使用这些目录。 (i.e. by editing setup.py and/or setup.cfg). 当你安装好依赖包之后, 运行:

$ pip install Pillow

Linux 下安装

注解

Fedora, Debian/Ubuntu, and ArchLinux 已经包含了 Pillow。

注解

你 不需要 安装所有的外部库如果你只想让 Pillow 基本能运行。

我们不为 Linux 提供二进制文件 如果你不是从源码构建的 Python , 那么先确定你安装了 Python 开发环境,在 Debian 或 Ubuntu:

$ sudo apt-get install python-dev python-setuptools

或者使用 Python 3:

$ sudo apt-get install python3-dev python3-setuptools

在 Fedora , 命令是:

$ sudo yum install python-devel

在 Ubuntu 10.04 LTS 安装依赖包:

$ sudo apt-get install libtiff4-dev libjpeg62-dev zlib1g-dev \
libfreetype6-dev tcl8.5-dev tk8.5-dev python-tk

在 Ubuntu 12.04 LTS 或者 Raspian Wheezy 7.0 安装依赖包:

$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk

在 Fedora 20 安装依赖包:

$ sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
lcms2-devel libwebp-devel tcl-devel tk-devel

Mac OS X 下安装

注解

你 不需要 安装所有的外部库如果你只想让 Pillow 基本能运行。

我们不为 OS X 提供二进制文件,所以你需要先安装 Xcode 才能安装 Pillow 。 (XCode 4.2 on 10.6 可以和官方 Python 二进制版本使用。或者使用任意版本 XCode 自己编译 Python。)

安装依赖包最简单的方法是使用 Homebrew。安装 Homebrew 之后,运行:

$ brew install libtiff libjpeg webp little-cms2

如果你已经构建了Python,可以运行:

$ pip install Pillow

Windows 下安装

我们在 PyPI 提供 Windows 二进制文件,使用 Python Wheels:

Python Eggs

注解

pip 不支持 Python Eggs; 请使用 easy_install 代替。

$ easy_install Pillow

Python Wheels

注解

实验性. 需要 setuptools >=0.8 以及 pip >=1.4.1

$ pip install --use-wheel Pillow

如果上面都不行,尝试安装指定版本:

$ pip install --use-wheel Pillow==2.3.0

平台支持

下面是平台支持情况,一般来说,我们致力于支持大多数平台。

注解

如果你在某平台测试过,编辑这个文件然后在 Github 提交 request 。

Operating system Supported Tested Python versions Tested Pillow versions Tested processors
Mac OS X 10.8 Mountain Lion Yes 2.6,2.7,3.2,3.3   x86-64
Mac OS X 10.7 Lion Yes 2.6,2.7,3.2,3.3 2.2.0 x86-64
Redhat Linux 6 Yes 2.6   x86
CentOS 6.3 Yes 2.7,3.3   x86
Fedora 20 Yes 2.7,3.3 2.3.0 x86-64
Ubuntu Linux 10.04 LTS Yes 2.6 2.3.0 x86,x86-64
Ubuntu Linux 12.04 LTS Yes

2.6,2.7,3.2,3.3,PyPy2.1

2.7,3.2

2.3.0

2.3.0

x86,x86-64

ppc

Ubuntu Linux 13.10 Yes 2.7,3.2,3.3 2.3.0 x86
Raspian Wheezy Yes 2.7,3.2 2.3.0 arm
Gentoo Linux Yes 2.7,3.2 2.1.0 x86-64
Windows 7 Pro Yes 2.7,3.2,3.3 2.2.1 x86-64
Windows Server 2008 R2 Enterprise Yes 3.3   x86-64
Windows 8 Pro Yes 2.6,2.7,3.2,3.3,3.4a3 2.2.0 x86,x86-64
Windows 8.1 Pro Yes 2.6,2.7,3.2,3.3,3.4 2.3.0, 2.4.0 x86,x86-64
 

python 安装pillow的更多相关文章

  1. python安装pillow模块错误

    安装的一些简单步骤就不介绍了,可以去搜索一下,主要就记录下我在安装pillow这一模块遇到的问题 1:安装好pillow后,安装过程没有出错 2:但是在python的IDLE输入from PIL im ...

  2. python3.4.2 安装Pillow

    Python 3.x 安装Pillow给Python安装Pillow非常简单,使用pip或easy_install只要一行代码即可.在命令行使用PIP安装: pip install Pillow或在命 ...

  3. Windows下Python中pip安装Pillow报错总结(转载)

    遇到的俩种错误1.ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting 问题原因 ...

  4. Python验证码识别 安装Pillow、tesseract-ocr与pytesseract模块的安装以及错误解决

    1.安装Pillow pip install Pillow 2.安装tesseract-ocr OCR(Optical Character Recognition, 光学字符识别) 软件 安装包含两个 ...

  5. pyhton安装pillow问题解决

    最近在学习Python的微信处理相关,因wxpy库中的微信客户端需要接收二维码需要安装pillow,如下 class wxpy.Bot(cache_path=None, console_qr=Fals ...

  6. windows 下的python 安装pycrypto

    一般在官方网站下载pycrypto: https://www.dlitz.net/software/pycrypto/   然后使用命令就可以安装成功了: python setup.py build  ...

  7. Python安装与使用的常见问题

    1. Python安装问题 到Python官网下载Python最新版本 Windows x86-64 executable installer (64为操作系统选择这个) Windows x86 ex ...

  8. Windows下安装pillow、opencv库问题,亲测可行

    安装pillow 库 python -m pip install pillow 出自:http://blog.csdn.net/Riverhope/article/details/78766969 安 ...

  9. windows上,python安装非官方包,提示error: Unable to find vcvarsall.bat

    在windows机器上安装python非官方包,如果环境只是用于开发,不作任何测试的话,最好的解决办法是: 在Linux上pip安装好之后,把python根目录lib/python3.6/site-p ...

随机推荐

  1. Codeforces Round #215 (Div. 2) C. Sereja and Algorithm

    #include <iostream> #include <vector> #include <algorithm> #include <string> ...

  2. ACM:统计难题 解题报告-字典树(Trie树)

    统计难题 Time Limit:2000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u Submit Status ...

  3. RTC实时时钟

    作者:宋老师,华清远见嵌入式学院讲师. 1.1 RTC介绍 在 一个嵌入式系统中,通常采用RTC 来提供可靠的系统时间,包括时分秒和年月日等,而且要求在系统处于关机状态下它也能够正常工作(通常采用后备 ...

  4. Js中的window.parent ,window.top,window.self 详解

    在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),self是当前窗口, opener是用open方法 ...

  5. Linux_linux中profile、bashrc、bash_profile之间的区别和联系(转)

    /etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行. 并从/etc/profile.d目录的配置文件中搜集shell的设置. 英文描述为: # /etc/p ...

  6. app设计需注意的

    手机上同步photoshop设计稿: ps play应用 设计: 资源: 1.音乐上传问题 音乐控制在2M以内,推荐使用[格式工厂]进行压缩. 2.视频上传问题 为了保证在线的播放效果,上传的视频大小 ...

  7. 关于ueditor1_4_3 上传出现无法加载配置的问题

    我的解决方案是: 1. 检查 ueditor.config.js  中的 serverUrl: URL + "/net/controller.ashx" 的配置,记得一定用绝对路径 ...

  8. [读书]10g/11g编程艺术深入体现结构学习笔记(持续更新...)

    持续更新...) 第8章 1.在过程性循环中提交更新容易产生ora-01555:snapshot too old错误.P257 (这种情况我觉得应该是在高并发的情况下才会产生) 假设的一个场景是系统一 ...

  9. array_sum函数 number array_sum

    数组的概念 数组就是一个用来存储一系列变量值的命名区域,每个数组元素有一个相关的索引,也成为关键字,它可以用来访问元素. PHP允许间隔性地使用数字或字符串作为数组的索引. 2.数字索引数组 2.1 ...

  10. 数据结构--树(遍历,红黑,B树)

    平时接触树还比较少,写一篇博文来积累一下树的相关知识. 很早之前在数据结构里面学的树的遍历. 前序遍历:根节点->左子树->右子树 中序遍历:左子树->根节点->右子树 后序遍 ...