我想使用pip在Mavericks上安装PIL,但是会出现此错误.
_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found #include^ 1 error generated. error: command 'cc' failed with exit status 1
我的命令行工具已安装并且是最新的,我发现的每个提示都没有帮助.我该如何编译?
编辑:我刚刚检查过,freetype也已经通过自制软件安装了
而不是符号链接到特定版本的freetype2,执行以下操作:
ln -s /usr/local/include/freetype2 /usr/local/include/freetype
这样可以省去每次升级freetype2时重新创建符号链接的麻烦.
这是由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
使用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.