Install PIL in Ubuntu 12.04 Python 2.7 and Python 3.2

后端 未结 3 1024
粉色の甜心
粉色の甜心 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 20:49

    Your instructions are too long and not entirely scripted, these are better (same platform — recent Debian/Ubuntu):

    sudo aptitude install python3-pip git
    pip-3.2 install --user git+https://github.com/python-imaging/Pillow
    
    0 讨论(0)
  • 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)

    0 讨论(0)
  • 2020-12-14 21:05

    [(I seem to be making a mess of things in the comments, sorry about that, here's a better version)

    The error clearly states that you're missing setuptools for python3. The package python3-setuptools should take care of that (run sudo apt-get install python3-setuptools).

    Then, as you noticed, default PIL doesn't work for python3. The current state of the github master of Pillow does, however. That will install by using python3 setup.py build and sudo python3 setup.py install.

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