我解决了我的问题,以下是详细信息:
首先,我重新检查此错误信息:
文件“/usr/local/lib/python2.7/dist-packages/scikit_image-0.11.3-py2.7-linux-x86_64.egg/skimage/io/_plugins/pil_plugin.py”,第 52 行,在 imread raise ValueError('Could not load "%s"\n请参阅文档:%s' % (fname, site)) ValueError: Could not load "bird.jpg" 请参阅文档:http ://pillow.readthedocs.org /en/latest/installation.html#external-libraries
这是 imread 的错误,我检查了文件pil_plugin.py,我发现它出现了这个错误
im = Image.open(fname)
try:
# this will raise an IOError if the file is not readable
im.getdata()[0]
except IOError:
site = "http://pillow.readthedocs.org/en/latest/installation.html#external-libraries"
raise ValueError('Could not load "%s"\nPlease see documentation at: %s' % (fname, site))
else:
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
所以im.getdata()很可能是错误的,然后我运行它并引发错误:
im.getdata() IOError:读取图像文件时数据流损坏。
然后我按照Matt WD 的解决方案重新安装 jpeg6,删除 Pillow 安装的PIL包,然后通过从http://effbot.org/downloads#pil下载文件重新安装 PIL 。
最后,我链接了libjpeg
ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
sudo ldconfigthe
错误消失了