Python Image Library: AttributeError: 'NoneType' object has no attribute XXX

前端 未结 2 2011
温柔的废话
温柔的废话 2020-12-16 16:02

I opened a picture with PIL, but when I tried to use split() to split the channels I got following error: AttributeError: \'NoneType\' object has no attri

2条回答
  •  旧时难觅i
    2020-12-16 16:33

    My problem was that PIL was not installed correctly. When trying to read a png I'd get that error. My compilation summary yielded

    --------------------------------------------------------------------
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.3 (default, Apr 21 2012, 01:05:55)
                  [GCC 4.6.3]
    --------------------------------------------------------------------
    *** TKINTER support not available
    *** JPEG support not available
    *** ZLIB (PNG/ZIP) support not available <===============
    *** FREETYPE2 support not available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    

    I then opted to "pip uninstall pil" and used the Synaptic Package Manager instead. That fixed it.

提交回复
热议问题