在Mac OS X 10.9上使用pip安装Python Image Library时出错

Luk*_*ieß 78 python macos pip

我想使用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
Run Code Online (Sandbox Code Playgroud)

我的命令行工具已安装并且是最新的,我发现的每个提示都没有帮助.我该如何编译?

编辑:我刚刚检查过,freetype也已经通过自制软件安装了

mcu*_*ere 210

而不是符号链接到特定版本的freetype2,执行以下操作:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype
Run Code Online (Sandbox Code Playgroud)

这样可以省去每次升级freetype2时重新创建符号链接的麻烦.

  • 这也解决了优胜美地的问题 (3认同)
  • 我运行El Capitan的机器上没有安装Freetype2,所以我必须在制作这个符号链接之前运行`brew install freetype` (2认同)

Mik*_*gel 31

使用macports,这个解决方案对我有用:

sudo port install freetype
sudo ln -s /opt/local/include/freetype2 /opt/local/include/freetype
Run Code Online (Sandbox Code Playgroud)

然后重新运行PIL构建过程.


Dmi*_*nin 28

我用这个符号链接解决了这个问题:

ln -s /usr/local/Cellar/freetype/2.5.1/include/freetype2 /usr/local/include/freetype
Run Code Online (Sandbox Code Playgroud)

我已经通过自制软件安装了freetype.


nev*_*nic 5

这是由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