Ali Sarikhani
Ali Sarikhani

Reputation: 11

why " attribute error: module PIL has no attribute Image" raises unlike its installed and code is correct

I'm new in python; I install the pillow package with pip and try to import that in my code but when I run the code it's shows AttributeError: module PIL has no attribute Image. here is my code: import PIL

with PIL.Image.open("before1.jpg") as Im:
    Im.show()

I reinstall python and pillow but nothing change; I try it with pillow 8.0.0 but nothing change; previously I have same problem with pytest

Upvotes: 1

Views: 672

Answers (1)

dwaltsch
dwaltsch

Reputation: 116

You need to import it like this from PIL import Image so that it can find the Image class

Upvotes: 1

Related Questions