问题描述
我正在做关于胆识的深度学习课程.对于第一次分配,当我尝试运行问题1以下的脚本时,出现了此错误.因此,我尝试卸载PIL和枕头,然后分别安装它们,但未成功.我需要帮助的人.我正在将tensorflow docker映像与python笔记本一起使用.
I am doing a deep learning course on udacity. For the first assignment whenI tried to run the script which is below the problem 1 , I got this error. So I tried to uninstall PIL and pillow and then installed these individually but I didnot succeeded.I need help guy. I am using tensorflow docker image with python notebook.
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import scipy
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle
# Config the matplotlib backend as plotting inline in IPython
%matplotlib inline
url = 'http://commondatastorage.googleapis.com/books1000/'
last_percent_reported = None
def download_progress_hook(count, blockSize, totalSize):
percent = int(count * blockSize * 100 / totalSize)
if last_percent_reported != percent:
if percent % 5 == 0:
sys.stdout.write("%s%%" % percent)
sys.stdout.flush()
else:
sys.stdout.write(".")
sys.stdout.flush()
last_percent_reported = percent
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/udacity/1_notmnist.ipynb
您可以在此处查看代码.问题1后代码块出现错误错误图片
You can see the code here. I got error in the code block after problem 1Error Image
我尝试了以下两个链接或解决方案中描述的所有内容:
I tried each and everything describe here in these two links or solutions:
操作系统:
使用docker和tensorflow将其安装在具有IPython Notebook的容器中.
using docker and tensorflow is installed in a container with IPython notebook.
python -c的输出"import tensorflow; print(tensorflow.版本)".
The output from python -c "import tensorflow; print(tensorflow.version)".
0.11.0
推荐答案
pip install pillow
然后替换from IPython.display import display, Image
和from IPython.display import display
from PIL import Image
这篇关于ImportError:无法导入在tensorflow上加载图像文件所需的Python Imaging Library(PIL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!