Python 如何在OS X Mountain Lion上构建PIL?
当我尝试在Mac OS X 10.8.1 Mountain Lion上构建PIL时,我得到了以下结果:Python 如何在OS X Mountain Lion上构建PIL?,python,macos,python-imaging-library,osx-mountain-lion,Python,Macos,Python Imaging Library,Osx Mountain Lion,当我尝试在Mac OS X 10.8.1 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-
$ 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
从中,我可以在/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7中找到Python.h。(注意,我已经安装了Xcode)
然后我运行了sudo python setup.py build\u ext——include dirs/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/python.framework/framework/Versions/2.7/include/python2.7:/Developer/SDKs/MacOSX10.7.sdk/usr/include
(注意:添加了/Developer/SDKs/MacOSX10.7.sdk/usr/include
,因为一旦解析了Python.h,stdio.h就丢失了)
最后,我运行了sudo python setup.py安装程序,在/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/python.framework/Versions/2.7/include/python2.7中找到了python.h。(注意,我已经安装了Xcode)
然后我运行了sudo python setup.py build\u ext——include dirs/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/python.framework/framework/Versions/2.7/include/python2.7:/Developer/SDKs/MacOSX10.7.sdk/usr/include
(注意:添加了/Developer/SDKs/MacOSX10.7.sdk/usr/include
,因为一旦解析了Python.h,stdio.h就丢失了)
最后,我运行了
sudo python setup.py install
PIL无法跟上对新操作系统的支持(通过更改setup.py以获得新的lib dir等)。但是,除了PIL,您可以使用“友好的PIL叉子”枕头:
- PIL无法跟上对新操作系统的支持(通过更改setup.py以获得新的lib dir等)。但是,除了PIL,您可以使用“友好的PIL叉子”枕头: