python 安裝pillow


安裝

警告

 

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 6b8, 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
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM