【发布时间】:2019-07-30 20:56:29
【问题描述】:
我正在尝试使用此代码在 jupyter notebook 中使用 python 打开图像。
这是代码:
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
# Read Images
img = mpimg.imread('C:/Users/alvar/Desktop/IE/1 - Full-time/Term 2/Machine Learning 2/Assigments/Group/For sunday/Tanzania.png')
# Output Images
plt.imshow(img)
并且给了我这个错误:
ValueError Traceback(最近调用 最后)在 3 4 # 读取图片 ----> 5 img = mpimg.imread('C:/Users/alvar/Desktop/IE/1 - Full-time/Term 2/Machine Learning 2/Assigments/Group/For 星期日/坦桑尼亚.png') 6 7 # 输出图片
~\Anaconda3\lib\site-packages\matplotlib\image.py in imread(fname, 格式)1373 其他:1374 带打开(fname, 'rb') 作为 fd: -> 1375 返回处理程序(fd) 1376 其他:1377 返回处理程序(fname)
ValueError: 无效的 PNG 标头
【问题讨论】:
标签: python jupyter-notebook png jupyter