Error installing Python Image Library using pip on

2019-01-16 01:36发布

I want to install PIL on Mavericks using pip but get this error.

_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

My Command Line Tools are installed and up to date and every hint I found didn't help. How can I get this to compile?

EDIT: I just checked, freetype is also already installed via homebrew

标签: python macos pip
11条回答
forever°为你锁心
2楼-- · 2019-01-16 01:42

I just solved this using the steps described in this Stackoverflow answer. Seems this is Xcode's fault for installing freetype in strange locations.

查看更多
冷血范
3楼-- · 2019-01-16 01:42

Instead of symlinking to a specific version of freetype2, do this:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

This saves you the trouble of recreating the symlink whenever you upgrade freetype2.

查看更多
相关推荐>>
4楼-- · 2019-01-16 01:51

After many attempts, I solved this problem compiling the PIL without freetype support. To do that, I simply unlinked from my $PATH using brew unlink freetype and then, pip install PIL==1.1.7.

查看更多
Deceive 欺骗
5楼-- · 2019-01-16 01:51

In my OSx, I found the .h file in /opt/local/include/freetype2 direcoty. So, I type

sudo ln -s /opt/local/include/freetype2/ /usr/local/include/freetype

it works

Maybe the best way is to add /opt/local/include to your clang's include path.

查看更多
趁早两清
6楼-- · 2019-01-16 01:55

With macports, the solution that worked for me:

sudo port install freetype
sudo ln -s /opt/local/include/freetype2 /opt/local/include/freetype

And then re-run the PIL build process.

查看更多
太酷不给撩
7楼-- · 2019-01-16 01:56

I've solved this problem with this symlink:

ln -s /usr/local/Cellar/freetype/2.5.1/include/freetype2 /usr/local/include/freetype

I have freetype already installed via homebrew too.

查看更多
登录 后发表回答