2012-08-29 35 views
1

当我尝试建立PIL在Mac OS X 10.8.1山狮,我得到以下结果:如何在OS X Mountain Lion上构建PIL?

$ sudo python setup.py install 
Password: 
running install 
running build 
running build_py 
running build_ext 
--- using frameworks at /System/Library/Frameworks 
building '_imaging' extension 
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include -I/usr/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.8-intel-2.7/_imaging.o 
clang: warning: argument unused during compilation: '-mno-fused-madd' 
_imaging.c:75:10: fatal error: 'Python.h' file not found 
#include "Python.h" 
     ^
1 error generated. 
error: command 'clang' failed with exit status 1 
+0

这是升级还是干净安装?我无法在干净的安装上重现。 – aclark

+0

这是Lion的升级版本(我认为是10.7.4),它也将Python手动升级到2.7。由于Pillow在干净的安装上工作,我认为对我来说这是一个足够可接受的答案。感谢您检查这一点,并为您在枕头上的工作:) –

回答

5

PIL没有跟上对新操作系统的支持(通过对新的lib目录的setup.py进行更改等)。但PIL的intstead,您可以使用 “友好PIL叉” 枕头

,如果你得到了同样的错误,请报告问题:

+0

我应该提到,当我试图安装枕头时,我得到了同样的错误。然后我回到我在答案中描述的手动安装方法。 –

+1

你也应该报告一个问题,以便我们可以解决它:-) https://github.com/python-imaging/Pillow/issues/new – aclark

+0

供参考:在新安装的山狮,枕头安装好了截至2012年1月 –

0

this SO question,我能找到Python.h在/ Developer /软件开发工具包/ MacOSX10。 7.sdk /系统/资源库/框架/ Python.framework /版本/ 2.7 /包括/ python2.7。 (请注意,我已经安装的Xcode)

我然后跑sudo python setup.py build_ext --include-dirs /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7:/Developer/SDKs/MacOSX10.7.sdk/usr/include

(注:/Developer/SDKs/MacOSX10.7.sdk/usr/include添加,因为stdio.h中失踪一旦Python.h得到解决)

最后,我跑sudo python setup.py install

相关问题