python - Django/PIL 错误 - 呈现 : The _imagingft C module is not installed 时捕获异常

标签 python django macos python-imaging-library

我正在尝试在我的机器上运行一个网络应用程序/网站,它在 OSX 10.6.2 上运行,但我遇到了一些问题:

Caught an exeption while rending: The _imagingft C module is not installed

在 python 中执行 import _imagingft 给我这个:

>>> import _imagingft
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imagingft.so,
2): Symbol not found: _FT_Done_Face
 Referenced from: /Library/Python/2.6/site-packages/PIL/_imagingft.so
 Expected in: flat namespace
 in /Library/Python/2.6/site-packages/PIL/_imagingft.so

似乎是 Freetype 库有问题。到目前为止,安装 PIL 或编译(?)jpeg 和 freetype 库时没有错误。

我使用的是 django 1.1.1,python 2.6.2。

最佳答案

在(重新)安装 PIL 之前添加以下系统链接以在 Mac 10.6 Snow Leopard 上启用 freetype:

ln -s /usr/X11/include/freetype2 /usr/local/include/
ln -s /usr/X11/include/ft2build.h /usr/local/include/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.dylib

关于python - Django/PIL 错误 - 呈现 : The _imagingft C module is not installed 时捕获异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2478123/

相关文章:

macos - 在 Mac OS X 上为本地文件夹安装 SSHFS 以在 Ubuntu AWS 实例上编辑文件

ios - 在 iOS 和 OS X 之间共享应用内购买?

Python HTML 表格抓取(打印)

python - 使用 Paramiko 的标准输出作为子进程的标准输入

python - 没有为 Django 迁移创建模型表

django - Django 的 Haystack 是什么?

mysql - 无法与 MacOS 上运行的 MySQL 建立连接

python - 'NameError : global name is not defined' under pdb, 对于确实存在的字典

python - 如何展平 Pandas 数据框列中的列表?

python - 在 Django 模板中切片列表