简体   繁体   中英

Installing PIL on mac OS

I'm trying to install the Python PIL library on mac OS 10.13.

I know about Pillow, but I want my code to work on Google App Engine which only supports PIL.

I tried sudo pip install pil and got:

Collecting pil
  Could not find a version that satisfies the requirement pil (from versions: )
No matching distribution found for pil

This confuses me because pip search pil does list PIL in the results. Trying to install a specific version, like pil==1.1.6 , got the same result. Writing PIL instead of pil also didn't help.

I also tried giving an explicit URL: sudo pip install http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz but that got a compiler error:

In file included from _imagingtk.c:19:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.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

How can I get this installation to work?

I solved the X11 compiler error by doing xcode-select --install

Found the answer here: https://stackoverflow.com/a/43716118/310159

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM