首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为Python安装PIL库时出错

为Python安装PIL库时出错
EN

Stack Overflow用户
提问于 2014-12-11 10:27:18
回答 5查看 3.3K关注 0票数 3

在安装xcode之后,我执行了pip install Pillow和最后一个代码字符串:

代码语言:javascript
复制
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
EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2014-12-13 13:27:30

你先卸载PIL了吗?

尝试:

代码语言:javascript
复制
pip uninstall pil
pip uninstall pillow
brew install libtiff libjpeg webp little-cms2
pip install pillow

有关详细信息,请参阅https://pillow.readthedocs.io/en/stable/installation.html

票数 1
EN

Stack Overflow用户

发布于 2016-03-30 08:06:10

实际的问题是Xcode的命令行工具丢失了。要修复它,只需运行

代码语言:javascript
复制
xcode-select --install

在你的终端上。将弹出一个对话框,接受并安装Xcode的CLT。

看吧,这里

票数 2
EN

Stack Overflow用户

发布于 2014-12-11 11:44:58

PIL被废弃,使用枕头代替。

安装枕头:

代码语言:javascript
复制
 pip install Pillow
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27420559

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档