简体   繁体   中英

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:

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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