吴恩达深度学习第4课第3周编程作业 + PIL + Python3 + Anaconda环境 + Ubuntu + 导入PIL报错的解决

问题描述
做吴恩达深度学习第4课第3周编程作业时导入PIL包报错.

我的环境

  • 已经安装了Tensorflow GPU 版本
  • Python3
  • Anaconda

解决办法
安装pillow模块,而不是PIL模块.原因是PIL模块不支持python3, 只支持python2. Python3下应安装pillow模块代, 替PIL即可.

下面内容是根据自己环境的记录:
Ubuntu下我用Anaconda已经搭建好了Tensorflow GPU环境,环境名字是tf.
命令行下输入(下面命令不加sudo):

source activate tf  #激活Anaconda已经搭建好的名字为 tf 的环境
conda install pillow  #安装pillow, 而不是PIL, 因为我用的是python3
原文地址:https://www.cnblogs.com/ZhongliangXiang/p/8442903.html