21
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kerasに「PILが無い」と怒られた場合の対策

Last updated at Posted at 2018-02-03

KerasをPython3系で使っていて、以下のようなエラーで止まった場合が対象。

raise ImportError('Could not import PIL.Image. '
ImportError: Could not import PIL.Image. The use of `array_to_img` requires PIL.

素直にPILをインストールしようとしても、
pythonのバージョンが2.6じゃないとダメだと言われてしまう。

>conda install PIL
Fetching package metadata .............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - pil -> python 2.6*
  - python 3.5*
Use "conda info <package>" to see the dependencies for each package.

conda infoすると、PILの更新は2014年で止まっている模様。

pil 1.1.7 py26_0
----------------
file name   : pil-1.1.7-py26_0.tar.bz2
name        : pil
version     : 1.1.7
build string: py26_0
build number: 0
channel     : defaults
size        : 746 KB
arch        : x86_64
date        : 2014-01-01
license_family: Other
md5         : ebf2863cd37405f13d6096d1981e188d
noarch      : None
platform    : win32
url         : https://repo.continuum.io/pkgs/free/win-64/pil-1.1.7-py26_0.tar.bz
2
dependencies:
    python 2.6*

PILのFork版であるPillowを使いましょう。

Pillow is the “friendly PIL fork” by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. 
>conda install Pillow

Pillowについてはこちらのページが参考になりました。
PIL/Pillow チートシート

21
11
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
21
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?