YAMAGUCHI::weblog

海水パンツとゴーグルで、巨万の富を築きました。カリブの怪物、フリーアルバイター瞳です。

CygwinにPython Image Libraryをインストールする

動機

Djangoでmodels.ImageFieldsを使おうと思ったらvalidateしたときに怒られた.

方法

Windowsにはインストーラがあるみたいだけど,Cygwinなんでtar.gzファイルをゲット.

# wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz
# tar Imaging-1.1.6.tar.gz
# cd Imaging-1.1.6
# python setup.py build_ext -i
running build_ext
building '_imaging' extension
/usr/bin/gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DHAVE_LIBZ -IlibImaging -I/usr/include -I/usr/local/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.cygwin-1.5.25-i686-2.5/_imaging.o
      6 [main] python 4780 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\tk84.dll to same address as parent(0x18760000) != 0x18C70000
     10 [main] python 6108 fork: child 4780 - died waiting for dll loading, errno 11
error: Resource temporarily unavailable

あちゃー.こりゃーいかんわ.で,ちょろっと調べてみるとこんな記述発見.

# rebase -b 0x1000000000 /bin/tk84.dll
# python setup.py build_ext -i
(略)
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version       1.1.6
platform      cygwin 2.5.1 (r251:54863, May 18 2007, 16:56:43)
              [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 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.

キタコレ.ただ3つ使えてないわ.FREETYPE2のパッケージは入れてるんだけどなぁ.JPEGは入れてないから入れておくか.

# python setup.py build_ext -i
(略)
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version       1.1.6
platform      cygwin 2.5.1 (r251:54863, May 18 2007, 16:56:43)
              [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not available
--------------------------------------------------------------------

なんか諸々見るとコレでOKらしい.ふーん.じゃあインストール.

# python setup.py install