Why can't Python import Image from PIL?

后端 未结 17 1857
执念已碎
执念已碎 2020-12-03 06:49

The single line that I am trying to run is the following:

from PIL import Image

However simple this may seem, it gives an error:

         


        
17条回答
  •  执念已碎
    2020-12-03 07:03

    Any library/package you import must have its dependencies and subordinate parts in the same python directory. in linux if you

    Python3.x -m pip install

    what happens is, it installs on the default python. so first make sure that only 1 python 2.x and 1 python 3.x versions are on your pc.

    If you want to successfully install matplotlib you need these lines,

    python -m pip install matplotlib pillow numpy pandas
    

    the last 2 were auxiliary libs, and must have.

提交回复
热议问题