我是Python和Google App Engine的新手,但我对它的安装及其兼容性感到困惑。我正在使用mac os -x和eclipse helios并安装了pyDev插件,但尽管如此,我仍然会遇到错误。 。 。
每当我尝试从终端导入PIL时,它都不会给我任何错误,这意味着它已成功安装,但是当我在eclipse文件中使用相同的Import时。我得到编译错误:
"Unresolved Import"
请帮我解决这个问题
不知怎的,我试图修复它,然后它给我的错误说成像:通用包装中没有匹配的架构
当我将架构更改为32位时,我在Eclipse Log中给出了这个:
Traceback (most recent call last):
File "/Users/Vinay/Documents/EclispeHeliosWorkspace/helloworld/Main.py", line 7, in <module>
im.show()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1483, in show
_show(self, title=title, command=command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2123, in _show
apply(_showxv, (image,), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2127, in _showxv
apply(ImageShow.show, (image, title), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 41, in show
if viewer.show(image, title=title, **options):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 66, in show
self.show_image(image, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 85, in show_image
return self.show_file(self.save_image(image), **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 81, in save_image
return image._dump(format=self.get_format(image))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 488, in _dump
self.load()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 164, in load
self.load_prepare()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 231, in load_prepare
self.im = Image.core.new(self.mode, self.size)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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
我该怎么做:(?
答案 0 :(得分:1)
PIL有一些具体的安装说明。你见过他们吗?
这仅适用于您的本地开发环境。当你上传它时,将使用GAE提供的PIL版本,这意味着你还必须更新你的app.yaml文件:
libraries:
- name: PIL
version: "1.1.7"
IIRC您需要将其安装在应用程序目录本身的“内部”,以便您的应用程序可以在本地访问它。然而,在MAC上不确定。
答案 1 :(得分:0)
我刚刚在OS X 10.8.5 Mountain Lion上安装了Pillow(使用:sudo pip install Pillow)来获取Python 2.7.6中的PIL。
我在使用Eclipse Kepler的PyDev中遇到了同样的问题。修复:
转到:
Eclipse - &gt;偏好 - &gt; PyDev - &gt;口译员 - Python - &gt;库,然后单击“新建文件夹”。
然后导航至:
/Library/Python/2.7/site-packages
单击<打开,然后单击“应用”,然后单击“确定”。然后我退出Eclipse并重新启动 - 修复了问题。 :)