[英]Error updating/installing new Anaconda packages on Mac OS X 10.9
[英]Error installing Python Image Library using pip on Mac OS X 10.9
我想使用pip在Mavericks上安装PIL,但是会出现此错误。
_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found
#include <freetype/fterrors.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
我的命令行工具已安装并且是最新的,我发现的每个提示都没有帮助。 我该如何编译?
编辑:我刚刚检查过,freetype也已经通过自制软件安装了
而不是符号链接到特定版本的freetype2,执行以下操作:
ln -s /usr/local/include/freetype2 /usr/local/include/freetype
这样可以省去每次升级freetype2时重新创建符号链接的麻烦。
使用macports,这个解决方案对我有用:
sudo port install freetype
sudo ln -s /opt/local/include/freetype2 /opt/local/include/freetype
然后重新运行PIL构建过程。
我用这个符号链接解决了这个问题:
ln -s /usr/local/Cellar/freetype/2.5.1/include/freetype2 /usr/local/include/freetype
我已经通过自制软件安装了freetype。
这是由freetype> = 2.1.5的标头更改引起的。 PIL没有使用正确的文档方式来包含freetype标头,这导致构建失败,因为freetype最终删除了包含标头的长期不赞成的方式。 这个问题记录在http://freetype.sourceforge.net/freetype2/docs/tutorial/step1.html的顶部:
注意:从FreeType 2.1.6开始,不再支持旧的头文件包含方案。 这意味着如果您执行以下操作,现在会出现错误:
#include <freetype / freetype.h>
#include <freetype / ftglyph.h>
请将此问题上游问题发送给PIL的开发人员,并建议他们使用包含freetype标头的文档化方法:
#include <ft2build.h>
#include FT_ERRORS_H
经过多次尝试,我解决了在没有freetype支持的情况下编译PIL的问题。 为此,我只是使用brew unlink freetype
从我的$ PATH brew unlink freetype
,然后, pip install PIL==1.1.7
。
我只是解决了这个使用中描述的步骤此 #1的答案。 似乎这是Xcode在异常位置安装freetype的错误。
使用Pillow修复此问题“for real”:
您可以在哪里报告问题并及时查看问题:
在我的OSx中,我在/opt/local/include/freetype2
找到了.h
文件。 所以,我输入
sudo ln -s /opt/local/include/freetype2/ /usr/local/include/freetype
有用
也许最好的方法是将/opt/local/include
到你的clang的include路径中。
osx约塞米蒂,这对我有用:
(的virtualenv)
$ ln -s /opt/local/include/freetype2/ /usr/local/include/freetype2
$ pip install pil==1.1.7 --allow-external pil --allow-unverified pil
我正在使用Arch Linux并遇到了这个问题。 在我的情况下,必须从https://pypi.python.org/pypi/Pillow/2.2.1#downloads手动下载并解压缩zip文件。 然后我编辑的文件_imagingft.c
以改变从包括路径freetype/fterrors.h
到fterrors.h
因为没有freetype
子目录/usr/include/freetype2
其中fterrors.h
位于。 最后python setup.py install
工作正常。
编辑:我应该提到这是安装Pillow的解决方案,而不是PIL,但Pillow只是PIL的一个分支,它可能仍然适用于有这个问题的其他人。
如果你仍然在寻找像我读完这个和其他谷歌搜索后的答案,你可能有兴趣看到这个:
警告
Pillow> = 2.1.0不再支持“import _imaging”。 请使用“从PIL.Image导入核心作为_imaging”。
从这里开始
当你读到这篇文章时,页面可能已经改变,但文本至少仍然在这里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.