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

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

Topic source

为什么我运行》》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 ... [Delete] [Delete and Lock User]

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

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

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

在桌面 用户文件里


  • 1

Reply