Pythonで画像処理がしたいので、PIL(Python Image Library)モジュールを使う…ためのインストールメモ

python版GAE用SDK(windows)を使うとき、PILモジュールが無いよというエラーが出ていたので、解決しました。

エラー詳細

> python manage.py runserver
WARNING:root:Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
Running on app-engine-patch 1.0.2.2
INFO:google.appengine.tools.appengine_rpc:Server: appengine.google.com
INFO:root:Checking for  updates to the SDK.
WARNING:root:Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO:root:Running application gae-sample on port 8000: http://localhost:8000

GAEに説明があったので引用

images API は、Python Imaging Library をローカルで使用して、ローカルマシンでのテスト中に画像を変換します。SDK で Imaging API を使用するには、PIL モジュールをダウンロードしてローカルマシンにインストールする必要があります。

PILモジュールダウンロード&インストール

モジュールのダウンロードはこちらからできるようです。

ローカルの Python バージョンを調べると、バージョンは 2.5.4 でした。

> python
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

というわけで

  • Python Imaging Library 1.1.6 for Python 2.5 (Windows only)」をダウンロード。ファイル名は「PIL-1.1.6.win32-py2.5.exe」。
  • 「PIL-1.1.6.win32-py2.5.exe」を実行。

インストール時メモ

# デフォルト
Python Directory : C:\Python25\
Installation Directory : C:\Python25\Lib\site-packages\

これで終わりらしい。

テストする

起動してみる。

> python manage.py runserver
Runnging on app-engine-patch 1.0.2.2
INFO:google.appengine.tools.appengine_rpc:Server: appengine.google.com
INFO:root:Checking for updates to the SDK
INFO:root:Running application gae-sample on port 8000: http://localhost:8000

おおおー!エラーが消えたー!

終わり。

続きは後日、これ↓を参考にやる。

(追記)というわけで後日やった内容はこれ