Can't install PIL after Mac OS X 10.9

Vincent Audebert picture Vincent Audebert · Oct 23, 2013 · Viewed 92.5k times · Source

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.

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

/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 ?

Answer

Dmitry Demidenko picture Dmitry Demidenko · Oct 23, 2013

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