9

少し検索しましたが、PyPyでPILを使用するためのチュートリアルが見つかりませんでした。PyPyのブログによると、PILがサポートされています。

  • PYTHONPATHにpipを使用してPILをインストールしました。
  • ダウンロード後、pipは2つの.pydファイル(_imaging.pydと_imagingmath.pyd)を作成します。
  • インストール後、%PYTHONPATH%/ lib / site-packages/PILをPyPysite-packagesディレクトリにコピーしました。
  • スクリプト(PILを使用)を実行すると、_imagingCモジュールをインポートできないと表示されます。

どうすればいいですか?

編集:私はこれをWindows 7 x64(python 2.7.1 32ビット)で実行します

これがトレースバックです(pypy 1.4.1 Windowsバイナリ):

Traceback (most recent call last):
  File "app_main.py", line 53, in run_toplevel
  File "tools\python\gen_images.py", line 52, in <module>
    main()
  File "tools\python\gen_images.py", line 44, in main
    image = Image.open(file)
  File "d:\pypy\site-packages\PIL\Image.py", line 1965, in open
    return factory(fp, filename)
  File "d:\pypy\site-packages\PIL\ImageFile.py", line 91, in __init__
    self._open()
  File "d:\pypy\site-packages\PIL\GifImagePlugin.py", line 97, in _open
    self.seek(0) # get ready to read first frame
  File "d:\pypy\site-packages\PIL\GifImagePlugin.py", line 152, in seek
    self.dispose = Image.core.fill("P", self.size,
  File "d:\pypy\site-packages\PIL\Image.py", line 37, in __getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
4

2 に答える 2

13

これは私がしました:

$ /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')

チャームのように働いた。そうしてください。:)

于 2011-02-01T16:15:09.493 に答える
2

easy_installまたはpipがインストールされていなかったので、pipのドキュメントの指示に従ってください。

wget https://bootstrap.pypa.io/get-pip.py
pypy get-pip.py
pypy -m pip install pillow
于 2015-03-01T01:40:45.383 に答える