Mac OS X 10.9之后不能安装PIL吗?

时间:2022-07-26 00:23:12

I've just updated my Mac OS to 10.9 and I discovered that some (all?) of my Python modules are not here anymore, especially the Image one.

我刚刚更新了我的Mac OS到10.9,我发现我的Python模块的一些(全部?)已经不在这里了,尤其是图片。

So I try to execute sudo pip install pil, but I get this error:

所以我尝试执行sudo pip安装pil,但我得到这个错误:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found

#      include <X11/Xlib.h>

               ^

1 error generated.

error: command 'cc' failed with exit status 1

My Xcode is up-to-date and I don't have any idea. Is it possible that PIL is not yet 10.9 compatible ?

我的Xcode是最新的,我不知道。PIL可能还没有10.9兼容吗?

29 个解决方案

#1


209  

Following worked for me:

以下为我工作:

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11
sudo pip install pil

UPDATE:

更新:

But there is more correct solution below, provided by Will.

但下面有更正确的解决方案,由威尔提供。

open your terminal and execute: xcode-select --install

打开终端并执行:xcode-select—install。

#2


101  

open your terminal and execute:

打开终端并执行:

xcode-select --install

xcode-select——安装

#3


34  

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

helps for me! os x 10.9

给我帮助!os x 10.9

pip install pillow

but! after pip install ...

但是!pip安装后……

*** ZLIB (PNG/ZIP) support not available

and finally i fix it by running:

最后我通过跑步来解决这个问题:

xcode-select --install

then reinstall pillow

然后重新安装枕头

pip install pillow

PIL SETUP SUMMARY
    --------------------------------------------------------------------
    version      Pillow 2.2.1
    platform     darwin 2.7.5 (default, Aug 25 2013, 00:04:04)
                 [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
    --------------------------------------------------------------------
    --- TKINTER support available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- TIFF G3/G4 (experimental) support available
    --- FREETYPE2 support available
    --- LITTLECMS support available
    --- WEBP support available
    --- WEBPMUX support available
    --------------------------------------------------------------------

#4


13  

Works for me ( OS X Yosemite 10.10.2 - Python 2.7.9 ) :

为我工作(OS X Yosemite 10.10.2 - Python 2.7.9):

xcode-select --install
sudo pip install pillow

Try this to check it:

试试这个检查一下:

from PIL import Image
image = Image.open("file.jpg")
image.show()

#5


11  

Here is what I did, some steps may not be necessary just for PIL but I needed libpng and others anyways:

这就是我所做的,一些步骤可能并不仅仅是为了公益,但我需要libpng和其他任何方式:

1) Run xcode install, use this command or download updates from the app store:

1)运行xcode安装,使用此命令或从app store下载更新:

xcode-select --install

1b) Add the Command Line Tools optional tool, in Mountain Lion this was an option on the xcode Download page, but now you have to register with your apple id and download from: https://developer.apple.com/downloads/

添加命令行工具,在Mountain Lion中,这是xcode下载页面上的一个选项,但是现在你必须注册你的苹果id并下载:https://developer.apple.com/downloads/。

Look for Command Line Tools (OS X Mavericks) for Xcode

寻找Xcode的命令行工具(OS X Mavericks)。

2) Install everything needed for python (using brew), I believe you can use port as well:

2)安装python所需的一切(使用brew),我相信您也可以使用端口:

brew install readline sqlite gdbm
brew install python --universal --framework 
brew install libpng jpeg freetype

Unlink/ relink if needed i.e. if upgrading.

如果需要的话,如果需要的话,可以使用Unlink/ relink进行升级。

3) Install Pip and required modules:

3)安装Pip和所需模块:

easy_install pip 
sudo pip install setuptools --no-use-wheel --upgrade

4) Finally this works with no errors:

4)最后,无误差:

sudo pip install Pillow

UPDATE 11/04/14: PIL repo no longer receives updates or support so Pillow should be used. The below is now deprecated so stick with Pillow.

更新11/04/14:PIL repo不再接收更新或支持,所以应该使用枕头。下面是不赞成使用枕头。

sudo pip install pil --allow-external pil --allow-unverified pil

UPDATE (OLD) : The same thing applies when installing Pillow (PIL fork) and should be mentioned as its quickly becoming a replacement in most cases of PIL. Instead of installing pip in step 4, run this instead:

更新(旧):当安装枕头(PIL fork)时,同样的事情也会发生,在大多数情况下,它会很快成为替代。不要在步骤4中安装pip,而是运行以下步骤:

sudo pip install Pillow

Hope this helps someone!

希望这可以帮助别人!

#6


9  

installing command line tools fixed the issue for me

安装命令行工具为我解决了这个问题。

you have to install them separately as they are not part of the packages in xcode now:

您必须单独安装它们,因为它们现在不是xcode中的包的一部分:

https://developer.apple.com/downloads/index.action?=command%20line%20tools#

https://developer.apple.com/downloads/index.action?=command%20line%20tools

#7


8  

Non of those worked for me.. I kept receiving:

没有那些对我有用。我一直在接受:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1

So I found a work around with the following solution:

于是我找到了一个解决方案:

sudo export CFLAGS=-Qunused-arguments
sudo export CPPFLAGS=-Qunused-arguments
sudo pip install PIL --allow-external PIL --allow-unverified PIL

This way I was able to install.

这样我就可以安装了。

#8


6  

I had a similar problem: Installing pillow failed with clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future], installing command line tools failed with Can't install the software because it is not currently available from the Software Update server., and even after installing the command line tools manually, the compilation of PIL failed.

我遇到了一个类似的问题:在clang中安装了一个失败的包:错误:未知参数:'-mno-fused-madd' [- wunused -command-line- error-in-future],安装命令行工具失败,无法安装该软件,因为它目前无法从软件更新服务器获得。,甚至在手动安装命令行工具之后,PIL的编译也失败了。

This happens cause clang under the newest version of xcode doesn't warn on unknown compiler flags, but rather stop the compilation with a hard error.

这发生在最新版本的xcode中,clang并没有警告未知的编译器标志,而是用一个错误的错误来停止编译。

To fix this, just run export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" on the terminal before trying to compile (installing pil).

为了解决这个问题,在尝试编译(安装pil)之前,只需在终端上运行export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"。

#9


5  

Simply run

简单地运行

pip install pil --allow-external pil --allow-unverified pil

pip安装pil -allow-external pil -allow- unpil。

#10


3  

This my steps on mac os 10.9.1

这是我在mac os 10.9.1上的步骤。

1. sudo su
2. easy_install pip
3. xcode-select --install
4. pip install --no-index -f http://dist.plone.org/thirdparty/ -U PIL

#11


2  

You could use Homebrew to do the install http://brew.sh

您可以使用Homebrew来安装http://brew.sh。

brew tap Homebrew/python
brew install pillow

#12


2  

Make sure you have Command Line Tools installed on your xcode. Then execute:

确保在xcode上安装了命令行工具。然后执行:

sudo pip install pil --allow-external pil --allow-unverified pil

#13


2  

I was having the following error

我有以下错误。

building 'PIL._imagingft' extension
_imagingft.c:62:10: fatal error: 'freetype/fterrors.h' file not found

#include <freetype/fterrors.h>

         ^

1 error generated.

error: command 'cc' failed with exit status 1

The solution to this was to symlink freetype2 to freetype and this solved the problem.

解决这个问题的方法是将freetype2与freetype连接起来,这就解决了问题。

#14


2  

I didn't want to install XCode (I don't use it) and I'm loath to fiddle with Application directory. I've cribbed from the many answers in this post and the following two steps work for me with 10.9.5:

我不想安装XCode(我不使用它),我不愿意摆弄应用程序目录。我已经从这篇文章的很多答案中找到了答案,接下来的两个步骤对我来说是10.9.5:

sudo easy_install pip
sudo pip install pillow

It did appear to me strange that I had to use easy_install to install pip. But pip didn't want to work for me before that (re-)install.

奇怪的是,我不得不使用easy_install来安装pip。但是在那之前,pip并不想为我工作。

#15


1  

Found the solution ... You've to symlink X11 like this ln -s /opt/X11/include/X11 /usr/local/include/X11 and then sudo pip install pil should work.

发现解决方案…你必须像这个ln -s /opt/X11/include/X11 / usr/local/include/x11这样的symlink X11,然后sudo pip安装pil应该起作用。

#16


1  

Reusing @DmitryDemidenko's answer that is how it worked for me:

重新使用@DmitryDemidenko的答案,这就是它对我的作用:

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11

and then

然后

sudo pip install -U PIL --allow-external PIL --allow-unverified PIL

#17


1  

Execute the bellow command lines. Works like a charm on Mac OS 10.9.5

执行bellow命令行。在Mac OS 10.9.5上就像一个魅力。

easy_install pip

easy_install皮普

sudo pip install setuptools --no-use-wheel --upgrade

sudo pip安装setuptools——无需使用轮——升级。

sudo pip install Pillow

sudo pip安装枕头

Best, Theo

最好的,西奥

#18


0  

That's what I did:

这就是我所做的:

First upgrade to Xcode 5 (I am running 10.9). Then, execute the following commands in a terminal:

第一次升级到Xcode 5(我运行10.9)。然后,在终端执行以下命令:

$ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 usr/include/

#19


0  

A more complete solution requires the installation of the Xquartz X11 subsystem that has been built outside of Apple for several years now. Here are the steps I used to get it all working

一个更完整的解决方案需要安装Xquartz X11子系统,该子系统已经在苹果之外构建了好几年了。下面是我的工作步骤。

  1. Install XQuartz from http://xquartz.macosforge.org/landing/
  2. 安装XQuartz从http://xquartz.macosforge.org/landing/
  3. Run sudo pip install pillow
  4. 运行sudo pip安装枕头。

#20


0  

Had the same issue after update to 10.9 and fixed the error "command 'cc' failed with exit status 1" with this:

在更新到10.9后发生了相同的问题,并修正了错误“命令”cc以退出状态1失败的情况:

sudo sed -i '' -e 's/-mno-fused-madd//g' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py

sudo rm /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.pyc

pip install pillow

#21


0  

As the accepted answer is the right one with xcode-select --install but some people (including me) may encounter Can't install the software because it is not currently available from the Software Update server If you are using beta software (as I am using Yosemite now and had the same problem) you NEED to get the CLT separately since it is NOT included in XCode (even xcode beta) Head over to developers.apple.com and get CLT tools for your OS ;)

与xcode-select公认的回答是正确的——安装但有些人(包括我)可能会遇到不能安装软件,因为它不是当前可用的软件更新服务器如果使用测试版软件(我使用约塞米蒂现在有同样的问题)你需要单独解释水平理论,因为它不包括在XCode中(甚至XCodeβ)去developers.apple.com和工具为您的操作系统移植的相对于尸体供体;)

P.S. You don't need XQuartz for PIL or Pillow to work

附注:你不需要用XQuartz来做PIL或枕头。

#22


0  

My machine which was recently upgraded from OS 10.8 -> 10.9 got stuck in a loop between xcrun and lipo.

我的机器最近从OS 10.8 -> 10.9升级到xcrun和lipo之间。

Rename /usr/bin/lipo to /usr/bin/lipo_broken

将/usr/bin/lipo重命名为/usr/bin/lipo_broken

Refer to this thread for further information on how to resolve:

有关如何解决的进一步信息,请参阅此线程:

xcrun/lipo freezes with OS X Mavericks and XCode 4.x

xcrun/lipo冻结与OS X Mavericks和XCode 4.x。

#23


0  

Install Pillow instead:

安装枕头:

sudo pip install pillow

#24


0  

ln -s /usr/local/include/freetype2 /usr/local/include/freetype
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pil

#25


0  

Try this:

试试这个:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

#26


0  

sudo pip uninstall pillow
pip install pillow

worked for me. I'm running Python 2.7.9 on Yosemite.import PIL now works for me.

为我工作。我在Yosemite上运行Python 2.7.9。进口PIL现在对我有用。

#27


0  

Installing PIL (Imaging.1.1.7) on Mac OSC 10.10 Yosemite. I tried numerous fixes recommended here but ran into trouble with each one. I finally solved this problem by editing the setup.py file such that:

在Mac OSC 10.10 Yosemite上安装PIL (image .1.1.7)。我尝试了很多建议,但都遇到了麻烦。我最终通过编辑设置来解决这个问题。py文件这样:

TCL_ROOT = "/opt/X11/include"

TCL_ROOT = " / opt / X11 /包括“

which passes the appropriate include path for X11 in the compilation of _imagingtk.c, which was causing the problem for me. Worked immediately after change.

它在_imagingtk的编译中传递了X11的路径。c,这是我的问题。工作后立即改变。

#28


0  

I've moved from pyenv to virtualenv and this fixed my problem.

我已经从pyenv转到virtualenv,这解决了我的问题。

#29


-4  

  1. ln -s /opt/X11/include/X11 /usr/local/include/X11
  2. ln - s / opt / X11 / include / X11 /usr/local/include/X11
  3. pip install pil without sudo
  4. pip在没有sudo的情况下安装pil。

#1


209  

Following worked for me:

以下为我工作:

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11
sudo pip install pil

UPDATE:

更新:

But there is more correct solution below, provided by Will.

但下面有更正确的解决方案,由威尔提供。

open your terminal and execute: xcode-select --install

打开终端并执行:xcode-select—install。

#2


101  

open your terminal and execute:

打开终端并执行:

xcode-select --install

xcode-select——安装

#3


34  

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11/ /usr/local/include/X11

helps for me! os x 10.9

给我帮助!os x 10.9

pip install pillow

but! after pip install ...

但是!pip安装后……

*** ZLIB (PNG/ZIP) support not available

and finally i fix it by running:

最后我通过跑步来解决这个问题:

xcode-select --install

then reinstall pillow

然后重新安装枕头

pip install pillow

PIL SETUP SUMMARY
    --------------------------------------------------------------------
    version      Pillow 2.2.1
    platform     darwin 2.7.5 (default, Aug 25 2013, 00:04:04)
                 [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
    --------------------------------------------------------------------
    --- TKINTER support available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- TIFF G3/G4 (experimental) support available
    --- FREETYPE2 support available
    --- LITTLECMS support available
    --- WEBP support available
    --- WEBPMUX support available
    --------------------------------------------------------------------

#4


13  

Works for me ( OS X Yosemite 10.10.2 - Python 2.7.9 ) :

为我工作(OS X Yosemite 10.10.2 - Python 2.7.9):

xcode-select --install
sudo pip install pillow

Try this to check it:

试试这个检查一下:

from PIL import Image
image = Image.open("file.jpg")
image.show()

#5


11  

Here is what I did, some steps may not be necessary just for PIL but I needed libpng and others anyways:

这就是我所做的,一些步骤可能并不仅仅是为了公益,但我需要libpng和其他任何方式:

1) Run xcode install, use this command or download updates from the app store:

1)运行xcode安装,使用此命令或从app store下载更新:

xcode-select --install

1b) Add the Command Line Tools optional tool, in Mountain Lion this was an option on the xcode Download page, but now you have to register with your apple id and download from: https://developer.apple.com/downloads/

添加命令行工具,在Mountain Lion中,这是xcode下载页面上的一个选项,但是现在你必须注册你的苹果id并下载:https://developer.apple.com/downloads/。

Look for Command Line Tools (OS X Mavericks) for Xcode

寻找Xcode的命令行工具(OS X Mavericks)。

2) Install everything needed for python (using brew), I believe you can use port as well:

2)安装python所需的一切(使用brew),我相信您也可以使用端口:

brew install readline sqlite gdbm
brew install python --universal --framework 
brew install libpng jpeg freetype

Unlink/ relink if needed i.e. if upgrading.

如果需要的话,如果需要的话,可以使用Unlink/ relink进行升级。

3) Install Pip and required modules:

3)安装Pip和所需模块:

easy_install pip 
sudo pip install setuptools --no-use-wheel --upgrade

4) Finally this works with no errors:

4)最后,无误差:

sudo pip install Pillow

UPDATE 11/04/14: PIL repo no longer receives updates or support so Pillow should be used. The below is now deprecated so stick with Pillow.

更新11/04/14:PIL repo不再接收更新或支持,所以应该使用枕头。下面是不赞成使用枕头。

sudo pip install pil --allow-external pil --allow-unverified pil

UPDATE (OLD) : The same thing applies when installing Pillow (PIL fork) and should be mentioned as its quickly becoming a replacement in most cases of PIL. Instead of installing pip in step 4, run this instead:

更新(旧):当安装枕头(PIL fork)时,同样的事情也会发生,在大多数情况下,它会很快成为替代。不要在步骤4中安装pip,而是运行以下步骤:

sudo pip install Pillow

Hope this helps someone!

希望这可以帮助别人!

#6


9  

installing command line tools fixed the issue for me

安装命令行工具为我解决了这个问题。

you have to install them separately as they are not part of the packages in xcode now:

您必须单独安装它们,因为它们现在不是xcode中的包的一部分:

https://developer.apple.com/downloads/index.action?=command%20line%20tools#

https://developer.apple.com/downloads/index.action?=command%20line%20tools

#7


8  

Non of those worked for me.. I kept receiving:

没有那些对我有用。我一直在接受:

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1

So I found a work around with the following solution:

于是我找到了一个解决方案:

sudo export CFLAGS=-Qunused-arguments
sudo export CPPFLAGS=-Qunused-arguments
sudo pip install PIL --allow-external PIL --allow-unverified PIL

This way I was able to install.

这样我就可以安装了。

#8


6  

I had a similar problem: Installing pillow failed with clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future], installing command line tools failed with Can't install the software because it is not currently available from the Software Update server., and even after installing the command line tools manually, the compilation of PIL failed.

我遇到了一个类似的问题:在clang中安装了一个失败的包:错误:未知参数:'-mno-fused-madd' [- wunused -command-line- error-in-future],安装命令行工具失败,无法安装该软件,因为它目前无法从软件更新服务器获得。,甚至在手动安装命令行工具之后,PIL的编译也失败了。

This happens cause clang under the newest version of xcode doesn't warn on unknown compiler flags, but rather stop the compilation with a hard error.

这发生在最新版本的xcode中,clang并没有警告未知的编译器标志,而是用一个错误的错误来停止编译。

To fix this, just run export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" on the terminal before trying to compile (installing pil).

为了解决这个问题,在尝试编译(安装pil)之前,只需在终端上运行export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"。

#9


5  

Simply run

简单地运行

pip install pil --allow-external pil --allow-unverified pil

pip安装pil -allow-external pil -allow- unpil。

#10


3  

This my steps on mac os 10.9.1

这是我在mac os 10.9.1上的步骤。

1. sudo su
2. easy_install pip
3. xcode-select --install
4. pip install --no-index -f http://dist.plone.org/thirdparty/ -U PIL

#11


2  

You could use Homebrew to do the install http://brew.sh

您可以使用Homebrew来安装http://brew.sh。

brew tap Homebrew/python
brew install pillow

#12


2  

Make sure you have Command Line Tools installed on your xcode. Then execute:

确保在xcode上安装了命令行工具。然后执行:

sudo pip install pil --allow-external pil --allow-unverified pil

#13


2  

I was having the following error

我有以下错误。

building 'PIL._imagingft' extension
_imagingft.c:62:10: fatal error: 'freetype/fterrors.h' file not found

#include <freetype/fterrors.h>

         ^

1 error generated.

error: command 'cc' failed with exit status 1

The solution to this was to symlink freetype2 to freetype and this solved the problem.

解决这个问题的方法是将freetype2与freetype连接起来,这就解决了问题。

#14


2  

I didn't want to install XCode (I don't use it) and I'm loath to fiddle with Application directory. I've cribbed from the many answers in this post and the following two steps work for me with 10.9.5:

我不想安装XCode(我不使用它),我不愿意摆弄应用程序目录。我已经从这篇文章的很多答案中找到了答案,接下来的两个步骤对我来说是10.9.5:

sudo easy_install pip
sudo pip install pillow

It did appear to me strange that I had to use easy_install to install pip. But pip didn't want to work for me before that (re-)install.

奇怪的是,我不得不使用easy_install来安装pip。但是在那之前,pip并不想为我工作。

#15


1  

Found the solution ... You've to symlink X11 like this ln -s /opt/X11/include/X11 /usr/local/include/X11 and then sudo pip install pil should work.

发现解决方案…你必须像这个ln -s /opt/X11/include/X11 / usr/local/include/x11这样的symlink X11,然后sudo pip安装pil应该起作用。

#16


1  

Reusing @DmitryDemidenko's answer that is how it worked for me:

重新使用@DmitryDemidenko的答案,这就是它对我的作用:

ln -s  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 /usr/local/include/X11

and then

然后

sudo pip install -U PIL --allow-external PIL --allow-unverified PIL

#17


1  

Execute the bellow command lines. Works like a charm on Mac OS 10.9.5

执行bellow命令行。在Mac OS 10.9.5上就像一个魅力。

easy_install pip

easy_install皮普

sudo pip install setuptools --no-use-wheel --upgrade

sudo pip安装setuptools——无需使用轮——升级。

sudo pip install Pillow

sudo pip安装枕头

Best, Theo

最好的,西奥

#18


0  

That's what I did:

这就是我所做的:

First upgrade to Xcode 5 (I am running 10.9). Then, execute the following commands in a terminal:

第一次升级到Xcode 5(我运行10.9)。然后,在终端执行以下命令:

$ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers/X11 usr/include/

#19


0  

A more complete solution requires the installation of the Xquartz X11 subsystem that has been built outside of Apple for several years now. Here are the steps I used to get it all working

一个更完整的解决方案需要安装Xquartz X11子系统,该子系统已经在苹果之外构建了好几年了。下面是我的工作步骤。

  1. Install XQuartz from http://xquartz.macosforge.org/landing/
  2. 安装XQuartz从http://xquartz.macosforge.org/landing/
  3. Run sudo pip install pillow
  4. 运行sudo pip安装枕头。

#20


0  

Had the same issue after update to 10.9 and fixed the error "command 'cc' failed with exit status 1" with this:

在更新到10.9后发生了相同的问题,并修正了错误“命令”cc以退出状态1失败的情况:

sudo sed -i '' -e 's/-mno-fused-madd//g' /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.py

sudo rm /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_sysconfigdata.pyc

pip install pillow

#21


0  

As the accepted answer is the right one with xcode-select --install but some people (including me) may encounter Can't install the software because it is not currently available from the Software Update server If you are using beta software (as I am using Yosemite now and had the same problem) you NEED to get the CLT separately since it is NOT included in XCode (even xcode beta) Head over to developers.apple.com and get CLT tools for your OS ;)

与xcode-select公认的回答是正确的——安装但有些人(包括我)可能会遇到不能安装软件,因为它不是当前可用的软件更新服务器如果使用测试版软件(我使用约塞米蒂现在有同样的问题)你需要单独解释水平理论,因为它不包括在XCode中(甚至XCodeβ)去developers.apple.com和工具为您的操作系统移植的相对于尸体供体;)

P.S. You don't need XQuartz for PIL or Pillow to work

附注:你不需要用XQuartz来做PIL或枕头。

#22


0  

My machine which was recently upgraded from OS 10.8 -> 10.9 got stuck in a loop between xcrun and lipo.

我的机器最近从OS 10.8 -> 10.9升级到xcrun和lipo之间。

Rename /usr/bin/lipo to /usr/bin/lipo_broken

将/usr/bin/lipo重命名为/usr/bin/lipo_broken

Refer to this thread for further information on how to resolve:

有关如何解决的进一步信息,请参阅此线程:

xcrun/lipo freezes with OS X Mavericks and XCode 4.x

xcrun/lipo冻结与OS X Mavericks和XCode 4.x。

#23


0  

Install Pillow instead:

安装枕头:

sudo pip install pillow

#24


0  

ln -s /usr/local/include/freetype2 /usr/local/include/freetype
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install pil

#25


0  

Try this:

试试这个:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

#26


0  

sudo pip uninstall pillow
pip install pillow

worked for me. I'm running Python 2.7.9 on Yosemite.import PIL now works for me.

为我工作。我在Yosemite上运行Python 2.7.9。进口PIL现在对我有用。

#27


0  

Installing PIL (Imaging.1.1.7) on Mac OSC 10.10 Yosemite. I tried numerous fixes recommended here but ran into trouble with each one. I finally solved this problem by editing the setup.py file such that:

在Mac OSC 10.10 Yosemite上安装PIL (image .1.1.7)。我尝试了很多建议,但都遇到了麻烦。我最终通过编辑设置来解决这个问题。py文件这样:

TCL_ROOT = "/opt/X11/include"

TCL_ROOT = " / opt / X11 /包括“

which passes the appropriate include path for X11 in the compilation of _imagingtk.c, which was causing the problem for me. Worked immediately after change.

它在_imagingtk的编译中传递了X11的路径。c,这是我的问题。工作后立即改变。

#28


0  

I've moved from pyenv to virtualenv and this fixed my problem.

我已经从pyenv转到virtualenv,这解决了我的问题。

#29


-4  

  1. ln -s /opt/X11/include/X11 /usr/local/include/X11
  2. ln - s / opt / X11 / include / X11 /usr/local/include/X11
  3. pip install pil without sudo
  4. pip在没有sudo的情况下安装pil。