IOError:无法识别Python

时间:2016-09-20 10:19:04

标签: python image

我正在尝试运行这个启动代码,我试图让python读取照片,因为我试图让它复制1200个文件夹中的所有照片并将它们粘贴到我的深度学习项目的单张照片中。但我一直收到这个错误或问题。

from PIL import Image
im = Image.open("1.jpg")
im.show()

这是我尝试运行代码时得到的结果。

anthony@anthony-G53JW:~/design4$ python copy2.py
Traceback (most recent call last):
  File "copy2.py", line 2, in <module>
    im = Image.open("1.jpg")
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2289, in open
    preinit()
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 365, in preinit
    from PIL import JpegImagePlugin
  File "/usr/local/lib/python2.7/dist-packages/PIL/JpegImagePlugin.py", line 40, in <module>
    from PIL import Image, ImageFile, TiffImagePlugin, _binary
  File "/usr/local/lib/python2.7/dist-packages/PIL/TiffImagePlugin.py", line 50, in <module>
    from fractions import Fraction
  File "/usr/lib/python2.7/fractions.py", line 7, in <module>
    from decimal import Decimal
  File "/usr/lib/python2.7/decimal.py", line 139, in <module>
    import copy as _copy
  File "/home/anthony/design4/copy.py", line 25, in <module>
    dataset = Image.open("1.jpg")
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2317, in open
    % (filename if filename else fp))
IOError: cannot identify image file '1.jpg'

0 个答案:

没有答案