繁体   English   中英

无法在python中打开图像文件

[英]cannot open an image file in python

import Image


imageFile = "C:\Users\Abhi\Desktop\cbir-p\images.jpg"
im1 = Image.open(imageFile)



Error: 
File "C:\Users\Abhi\Desktop\cbir-p\im1.py", line 5, in <module>
    im1 = Image.open(imageFile)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 2025, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

帮帮我,我已经安装了所有必需的软件包PIL,Pillow,Opencv等。

嘿,这不是因为您的文件路径问题...

这是因为您的PIL中缺少JPEG支持,这是我在此处说明的解决方案。 https://apple.stackexchange.com/questions/59718/python-imaging-library-pil-decoder-jpeg-not-available-how-to-fix

转到此处下载lib libjpeg软件包。 要不就

brew install libjpeg

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM