StopIteration:无法导入 PIL.Image。使用 `array_to_img` 需要 PIL

StopIteration: Could not import PIL.Image. The use of `array_to_img` requires PIL

我在 运行 keras 代码时遇到此错误,因此 keras 正在尝试导入

from PIL import Image as pil_image

我已经安装了 pillow,我也可以在我的 python 终端中成功导入它,但是在 jupyter notebook 中它会出现导入错误。

env - ubuntu 16 在 aws ec2 实例上,我正在为 ubuntu

使用 aws 深度学习 ami

pillow自带conda,我也试过用pip安装

但我还是可以在 python/ipython shell 中导入它,但不能在 jupyter notebook 中导入。

因此,jupyter notebook 上的 jesper 或 opencv 包中似乎包含 pillow/pil,所以我在 notebook 的包门户中卸载了 jesper 和 opencv,并安装了 pillow。现在一切都很好 运行。

我安装了opencv。但我刚刚安装了枕头(保持 opencv)并且它对我有用。