如何将 PIL 与 PyPy 一起使用?
我进行了一些搜索,但找不到将 PIL 与 PyPy 一起使用的教程。根据 PyPy 的博客,支持 PIL。
- 我在 PYTHONPATH 中使用 pip 安装了 PIL。
- 下载后,pip make 2个.pyd文件:_imaging.pyd和_imagingmath.pyd。
- 安装后,我将 %PYTHONPATH%/lib/site-packages/PIL 复制到我的 PyPy site-packages 目录。
- 当我运行我的脚本(使用 PIL)时,它说它无法导入 _imaging C 模块。
我该怎么办呢?
编辑: 我在 Windows 7 x64 (python 2.7.1 32bits) 上运行它,
这是回溯 (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
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.
- After the download, pip make 2 .pyd files: _imaging.pyd and _imagingmath.pyd.
- After the install, I copied %PYTHONPATH%/lib/site-packages/PIL to my PyPy site-packages directory.
- When I run my script (which uses PIL), it says it can't import the _imaging C module.
How should I do it ?
edit:
I run this on Windows 7 x64 (python 2.7.1 32bits)
here is the traceback (pypy 1.4.1 windows binary):
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我这样做了:
效果很好。所以就这么做吧。 :)
I did this:
Worked like a charm. So do that. :)
我没有安装 easy_install 或 pip,因此请按照 pip 文档中的说明进行操作:
I had no easy_install or pip installed, so followed the instructions in pip's documentation: