当我使用easy_install或buildout安装PIL时,它会以这种方式安装,我必须执行'import Image',而不是'来自PIL import Image'.
但是,如果我做"apt-get install python-imaging"或使用"pip -E test_pil install PIL",一切正常.
以下是我尝试使用virtualenv安装PIL的示例:
# virtualenv --no-site-packages test_pil
# test_pil/bin/easy_install PIL
# test_pil/bin/python
Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
Run Code Online (Sandbox Code Playgroud)
我明白了,easy_install将PIL打包到Egg中,而PIP则没有.与buildbot相同,它使用鸡蛋.
如何使用easy_install或buildout正确安装PIL?
我真的很痛苦这个问题.
最初,在使用matplotlib绘制内容后,我可以轻松保存图像.
但是,安装scipy之后,我再也无法保存我的图像了.
(我使用pip安装了matplot和scipy.)
我试图查找一些信息,但我仍然无法解决问题.
我的操作系统是Mac OS X Lion(10.7)
我认为以下链接是一些相关问题
https://github.com/ipython/ipython/issues/2710
Matplotlib python savefig运行时错误python 3.2.3
matplotlib和libpng问题ipython notebook
libpng15静态链接问题
看来如果我可以重新链接库或设置DYLD_LIBRARY_PATH(实际上我不知道那是什么......)
或许我必须重新编译一些东西?
顺便说一下,我对基于linux的系统很新,所以如果有人能以一种相对简单的方式解释它,那将是非常好的.非常感谢你.
以下是一些错误消息:
libpng warning: Application was compiled with png.h from libpng-1.5.4
libpng warning: Application is running with png.c from libpng-1.4.10
libpng warning: Incompatible libpng version in application and library
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/Library/Python/2.7/site-packages/matplotlib/backends/backend_macosx.pyc in save_figure(self, *args)
476 if filename is None: # Cancel
477 return
--> 478 self.canvas.print_figure(filename)
479
480 def prepare_configure_subplots(self):
/Library/Python/2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, …Run Code Online (Sandbox Code Playgroud)