Package (Python PIL/Pillow) installed but I can't import it

前端 未结 3 1552
悲哀的现实
悲哀的现实 2020-12-03 16:01

I\'ve been using python for simple data processing scripts, but now I want to do some image processing and I encountered a problem. Importing the pillow module doesn\'t seem

相关标签:
3条回答
  • 2020-12-03 16:24

    You are importing incorrectly. Try using:

    import  PIL
    from PIL import Image
    

    PIL i.e Python Imaging Library is no longer maintained, Pillow is used instead. To maintain backwards compatibility, PIL module name is used in imports.

    0 讨论(0)
  • 2020-12-03 16:26

    In fact, Pillow is installed under name "PIL", so:

    import PIL as pillow
    from PIL import Image
    ...
    

    Look this:

    enter image description here

    0 讨论(0)
  • 2020-12-03 16:36

    Checkout the doc:

    http://pillow.readthedocs.org/handbook/tutorial.html

    You must import it like that:

    import PIL
    
    0 讨论(0)
提交回复
热议问题