[英]Error installing PIL library for Python
After installing xcode I executed pip install Pillow
and the last code strings say:安装 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
PIL is deprecated, use Pillow instead. PIL 已弃用,请改用 Pillow。
To install Pillow:安装枕头:
pip install Pillow
Did you uninstall PIL first?你是先卸载 PIL 吗?
Try:尝试:
pip uninstall pil
pip uninstall pillow
brew install libtiff libjpeg webp little-cms2
pip install pillow
See https://pillow.readthedocs.io/en/stable/installation.html for more information.有关更多信息,请参阅https://pillow.readthedocs.io/en/stable/installation.html 。
X
(or X11
) is a (the default) *nix window system, which some *nix software that can be compiled on a Mac relies upon. X
(或X11
)是一个(默认的)*nix 窗口系统,一些可以在 Mac 上编译的 *nix 软件依赖于它。
The problem appears to be that PIL and Pillow appear to assume you want Tk(inter)
, which in turns relies on X
.问题似乎是 PIL 和 Pillow 似乎假设您想要
Tk(inter)
,而后者又依赖于X
。 If you don't want fancy dialog stuff for your image processing, there should be a way to turn that off, though that may require a manual installation.如果您不想要花哨的对话内容进行图像处理,则应该有一种方法可以将其关闭,尽管这可能需要手动安装。
Alternatively, perhaps this answer may be of use;或者,也许这个答案可能有用; but that still requires
X
to be installed, and just fixes a bad link.但这仍然需要安装
X
,并且只是修复了一个错误的链接。
Installing SDK headers worked for me安装 SDK 标头对我有用
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For more information see https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624有关更多信息,请参阅https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035624
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.