关于作者

Discuss / Python / 为什么我运行im = Image.open('test.png')后出现错误

为什么我运行im = Image.open('test.png')后出现错误

Topic source

爱美食的Y先生

#1 Created at ...

为什么我运行》》im = Image.open('test.png')后出现错误

im = Image.open('test.png') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "F:\Users\loysaid_yan\AppData\Local\Programs\Python\Python35\lib\site-pac kages\PIL\Image.py", line 2530, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'test.png'

是不是我没有指定这个图片的地址啊

南城不南_

#2 Created at ...

是的,里面要加入路径 比如我的test.png放在D盘下,那么就改为im = Image.open('D:\test.png')

注意 冒号后面有两个'\',可能有个'\'被当成转义字符了,这里只显示了一个

庚你一起走nan

#3 Created at ...

按照那个程序运行出来的缩略图应该是在哪个位置保存着?


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.