LoginSignup
53
29

More than 5 years have passed since last update.

python3系でのPython Image Libraryの使用方法

Posted at

O'Reillyの「ゼロから作るDeep Learning」の3章。
MNIST画像(手書き数字認識のサンプル画像)を表示するのにPILを使うよって。

PIL(Python Image Library)についてはこちらなどご参照ください
http://www.lifewithpython.com/2013/09/pil.html

サンプルコードを写経して実行。したらエラーがでましたね。

from PIL import Image
...
Traceback (most recent call last):
  File "/Users/ukwksk/Training/orreilly-deep-learning/chapter03/section3_6_number_recognition.py", line 7, in <module>
    from PIL import Image
ImportError: No module named 'PIL'

「PILがありませんよ」
あ、標準ライブラリじゃないのね。

$ pip install PIL
Collecting PIL
  Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL

PILってライブラリはないの...?

調べたところ、PILは2系までのイブラリで、3系にはないっぽい
https://librabuch.jp/blog/2013/05/python_pillow_pil/

「本書では下記のプログラミング言語とライブラリを使用します。
- Python3系
- NumPy
- Matplotlib 」
とはなんだったのか..

というわけで上記のURLに従って
$ pip install pillow
で、無事に解決しました。

53
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
53
29