简体   繁体   English

在python中使用PIL加载图像

[英]Loading Images with PIL in python

I know that this question has been asked many times, but I still haven't seemed to got an answer from any of the other posts. 我知道这个问题已经问过很多遍了,但是我似乎还没有从其他帖子中得到任何答案。 I am just trying to load an image from my desktop using PIL: 我只是想使用PIL从桌面加载图像:

from PIL import Image
pic = Image.open("/Users/23athreyad/Desktop/turkishflag.jpg")
pic.show()

And I always seem to get the error: 而且我似乎总是会收到错误:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/23athreyad/Desktop/turkishflag.jpg'
(base)

I have specified the complete path of the file and don't know why it still can't find the image. 我已经指定了文件的完整路径,但不知道为什么它仍然找不到图像。

Any help appreciated... 任何帮助表示赞赏...

This means that you are providing the wrong absolute path for the file you want to open. 这意味着您为要打开的文件提供了错误的绝对路径。 It cannot be found at that location. 在那个位置找不到它。 The code you are using is correct and accurate to the official documentation . 您使用的代码对官方文档是正确且准确的。

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

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