How to use PIL with PyPy?

前端 未结 2 867
南方客
南方客 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: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. :)

提交回复
热议问题