天天看點

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

繼續閱讀