Install PIL in Ubuntu 12.04 Python 2.7 and Python 3.2

后端 未结 3 1053
粉色の甜心
粉色の甜心 2020-12-14 20:35

I am, using Ubuntu 12.04 server which by default has two versions of Python: 2.7 and 3.2. When I install PIL using the python setup.py install terminal command,

3条回答
  •  死守一世寂寞
    2020-12-14 21:03

    for those here to get scipy working with PIL (Pillow), on python3

    After executing the receipe Chin Ye above, I was then able to get scipy.misc.imread and scipy.misc.imsave to be available when issuing import scipy.misc by tweaking two lines in the file:

    /usr/lib/python3/dist-packages/scipy/misc/pilutil.py

    in that file, replace the lines:

    import Image
    import ImageFilter
    

    to be:

    from PIL import Image
    from PIL import ImageFilter
    

    the imports in scipy.misc.__init__ then worked to allow the contents of pilutil.py to work (esp image io - from numpy array formats)

    this was for Ubuntu 12.04 LTS, scipy.__version__ 0.9.0

    (for more information on the tweak itself, see the docs for the Pillow implementaion of PIL)

提交回复
热议问题