代码:
from matplotlib.image import imread
image = imread('ladybug.png')
image.shape
报错显示:
FileNotFoundError Traceback (most recent call last)
in
1 from matplotlib.image import imread
----> 2 image = imread('ladybug.png')
3 image.shape
D:\anaconda1\lib\site-packages\matplotlib\image.py in imread(fname, format)
1488 response = io.BytesIO(response.read())
1489 return imread(response, format=ext)
-> 1490 with img_open(fname) as image:
1491 return (_pil_png_to_float_array(image)
1492 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
D:\anaconda1\lib\site-packages\PIL\ImageFile.py in init(self, fp, filename)
107 if isPath(fp):
108 # filename
--> 109 self.fp = open(fp, "rb")
110 self.filename = fp
111 self._exclusive_fp = True
FileNotFoundError: [Errno 2] No such file or directory: 'ladybug.png'