安装xcode后,我执行了pip install Pillow
,最后的代码字符串说:
In file included from _imagingtk.c:19:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found
In file included from Tk/tkImaging.c:52:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found
# include <X11/Xlib.h>
^
1 error generated.
1 error generated.
Building using 4 processes
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/_imagingtk.o build/temp.macosx-10.9-intel-2.7/Tk/tkImaging.o -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -L/usr/X11/lib -L/usr/lib -o build/lib.macosx-10.9-intel-2.7/PIL/_imagingtk.so -framework Tcl -framework Tk
clang: error: no such file or directory: 'build/temp.macosx-10.9-intel-2.7/_imagingtk.o'
clang: error: no such file or directory: 'build/temp.macosx-10.9-intel-2.7/Tk/tkImaging.o'
error: command 'cc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build/Pillow/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-YMhwsU-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build/Pillow
Storing complete log in /var/root/Library/Logs/pip.log
答案 0 :(得分:2)
答案 1 :(得分:1)
PIL已弃用,请改用Pillow。
安装枕头:
pip install Pillow
答案 2 :(得分:0)
安装XQuartz。
X
(或X11
)是一个(默认的)* nix窗口系统,可以在Mac上编译的某些* nix软件依赖于它。
问题似乎是PIL和Pillow似乎假设你想要Tk(inter)
,而{I}又依赖于X
。如果你不想要花哨的对话框进行图像处理,应该有办法将其关闭,尽管这可能需要手动安装。
或者,也许this answer可能有用;但是仍然需要安装X
,并且只修复了错误的链接。
答案 3 :(得分:0)
您是否先卸载PIL?
尝试:
pip uninstall pil
pip uninstall pillow
brew install libtiff libjpeg webp little-cms2
pip install pillow
答案 4 :(得分:0)
安装SDK标头对我有用
if (savedInstanceState == null) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.main_container , new MainScreen());
fragmentTransaction.commit();
}
有关更多信息,请参见https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624