How to use PIL with PyPy?

前端 未结 2 870
南方客
南方客 2021-02-09 00:08

I searched a little bit but I couldn\'t find a tuto to use PIL with PyPy. According to PyPy\'s blog, PIL is supported.

  • I installed PIL with pip in my PYTHONPATH.
相关标签:
2条回答
  • 2021-02-09 01:04

    I had no easy_install or pip installed, so followed the instructions in pip's documentation:

    wget https://bootstrap.pypa.io/get-pip.py
    pypy get-pip.py
    pypy -m pip install pillow
    
    0 讨论(0)
  • 2021-02-09 01:05

    I did this:

    $ /opt/pypy-1.4.1/bin/virtualenv test
    $ cd test
    $ bin/pip install PIL
    ...
    --------------------------------------------------------------------
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.5.2 (e503e483e9ac, Dec 21 2010, 12:02:29)
                  [PyPy 1.4.1]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    ... 
    $ bin/pypy
    Python 2.5.2 (e503e483e9ac, Dec 21 2010, 12:02:29)
    [PyPy 1.4.1] on linux2
    >>>> import Image
    >>>> im = Image.open('/path/to/file.jpg')
    >>>> outfile = open('/path/to/file.png', 'wb')
    >>>> im.save(outfile, 'png')
    

    Worked like a charm. So do that. :)

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