在mac OS上安装PIL

时间:2017-12-11 00:00:35

标签: python macos pip python-imaging-library

我试图在mac OS 10.13上安装Python PIL库。

我了解Pillow,但我希望我的代码可以在仅支持PIL的Google App Engine上运行。

我尝试了sudo pip install pil并得到了:

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

这让我感到困惑,因为pip search pil会在结果中列出PIL。尝试安装特定版本(如pil==1.1.6)会得到相同的结果。写PIL代替pil也没有帮助。

我也尝试过提供一个明确的网址:sudo pip install http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz但是出现了编译错误:

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

如何才能使此安装正常工作?

1 个答案:

答案 0 :(得分:0)

我通过执行colorbar

解决了X11编译器错误

在这里找到答案:https://stackoverflow.com/a/43716118/310159