简体   繁体   English

在Mac Os X Mavericks(10.9)上为Python 3.4安装Pillow

[英]Install Pillow for Python 3.4 on Mac Os X Mavericks (10.9)

I want to install Pillow for Python 3.4 (PIL fork) on my mac osx 10.9. 我想在Mac OS X 10.9上安装Python 3.4枕头(PIL叉子)。 I've searched on the net but found no way to install it. 我在网上搜索,但找不到安装它的方法。 Any idea ? 任何想法 ?

I have both Python 2 and Python 3 installed via Homebrew : 我通过Homebrew安装了Python 2和Python 3:

Homebrew provides a formula for Python 2.7.x and one for Python 3.x. Homebrew为Python 2.7.x提供了一个公式,为Python 3.x提供了一个公式。 They don't conflict, so they can both be installed. 它们没有冲突,因此都可以安装。 The executable python will always point to the 2.x and python3 to the 3.x version. 可执行python将始终指向2.x,而python3始终指向3.x版本。

So: 所以:

$ brew update
$ brew install python3

This also gives pip for Python 2 and pip3 for Python 3. So you can install Pillow like: 这也为Python 2提供了pip为Python 3提供了pip3 。因此,您可以像下面那样安装Pillow

$ brew install libtiff libjpeg webp little-cms2
$ pip3 install pillow

Then: 然后:

$ python3
Python 3.4.0 (default, Apr  9 2014, 11:51:10) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
>>> im = Image.open("image.png")
>>> im.show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM