###背景
blockdiagというsphinxでナイスなブロック図を作成するツールがあるのですが
使おうとしたらコケたのでメモ
##The _imagingft C module is not installed
エラーが出た場合
0.pipやeasy_installなどでPILをアンインストール
1.必要なものをインストール
yum install zlib zlib-devel
yum install libjpeg libjpeg-devel
yum install freetype freetype-devel
yum install fontconfig-devel
2.ft2build.hとfreetypeの場所を確認
find / -name "ft2build.h"
/usr/include/ft2build.h
find / -name "freetype"
/usr/include/freetype2/freetype
3.ft2build.hをfreetypeと同じ場所に配置
cp /usr/include/ft2build.h /usr/include/freetype2
4.PILを自分でコンパイル
mkdir -p ~/src ~/lib/python2.7
cd ~/src
wget http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
tar zxf PIL-1.1.7.tar.gz
cd PIL-1.1.7
setup.py
# --------------------------------------------------------------------
# Library pointers.
#
# Use None to look for the libraries in well-known library locations.
# Use a string to specify a single directory, for both the library and
# the include files. Use a tuple to specify separate directories:
# (libpath, includepath). Examples:
#
# JPEG_ROOT = "/home/libraries/jpeg-6b"
# TIFF_ROOT = "/opt/tiff/lib", "/opt/tiff/include"
#
# If you have "lib" and "include" directories under a common parent,
# you can use the "libinclude" helper:
#
# TIFF_ROOT = libinclude("/opt/tiff")
TCL_ROOT = None
JPEG_ROOT = '/usr/lib64','/usr/include'
ZLIB_ROOT = '/lib64','/usr/include'
TIFF_ROOT = None
FREETYPE_ROOT = '/usr/lib64','/usr/include/freetype2/freetype'
LCMS_ROOT = None
5.python2.7 setup.py build_ext -i
で動作確認
running build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.3 (default, Apr 11 2013, 19:55:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
6.python2.7 setup.py install
でインストール
running install
running build
running build_py
running build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.7
platform linux2 2.7.3 (default, Apr 11 2013, 19:55:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/local/bin/pilconvert.py to 755
changing mode of /usr/local/bin/pilfile.py to 755
changing mode of /usr/local/bin/pildriver.py to 755
changing mode of /usr/local/bin/pilprint.py to 755
changing mode of /usr/local/bin/pilfont.py to 755
running install_egg_info
Removing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
Writing /usr/local/lib/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
creating /usr/local/lib/python2.7/site-packages/PIL.pth