在python中使用imread命令时出错

时间:2017-03-20 06:13:59

标签: python matplotlib imread

我输入了以下命令

import matplotlib.image as mpimg
img = mpimg.imread("test.jpg")

我收到以下错误:

TypeError                                 Traceback (most recent call last)
<ipython-input-12-009ac1935016> in <module>()

----> 1 img = mpimg.imread("test.jpg")

/usr/local/lib/python2.7/dist-packages/matplotlib/image.pyc in imread(fname, format)
   1225 
   1226     if ext not in handlers:
-> 1227         im = pilread(fname)
   1228         if im is None:
   1229             raise ValueError('Only know how to handle extensions: %s; '

/usr/local/lib/python2.7/dist-packages/matplotlib/image.pyc in pilread(fname)
   1203         except ImportError:
   1204             return None
-> 1205         with Image.open(fname) as image:
   1206             return pil_to_array(image)
   1207 

TypeError: 'NoneType' object is not callable

0 个答案:

没有答案