天天看点

MACOSX10.10 python 安装PIL失败-解决方法

最近想用python搞搞图像,于是安装了PIL  安装过程遇到些问题。

问题如下:

n file included from _imagingtk.c:19:
/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
           

问题原因是xcode不能找到X11头文件,我们对X11进行软连接。

完整安装过程如下:

1   

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

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
           

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

参考网址如下: 

http://www.ajucs.com/archives/565.html

继续阅读