CoreGraphics not found by Python on Mac OS
I'm trying to run so开发者_Go百科me of the Quartz demos in /Developer/Examples/Quartz/Python with Mac 10.5.8 and Python 2.6. However, I'm getting errors that CoreGraphics isn't found.
Traceback (most recent call last):
File "circle.py", line 38, in <module>
from CoreGraphics import *
ImportError: No module named CoreGraphics
In looking at Apple's documentation, isn't this supposed to be baked in? http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_python/dq_python.html#//apple_ref/doc/uid/TP30001066-CH218-TPXREF101
The CoreGraphics
wrapper is supplied by Apple as part of the Apple-supplied Python in OS X. Since in OS X 10.5 there is no Apple-supplied version of Python 2.6 (Apple supplies 2.5 and 2.3 there), you must be using a non-Apple version, possibly from a python.org installer or MacPorts. They will not have this module. Either switch to using the Apple-supplied 2.5 or take a look at using the open-source PyObjC Quartz bindings.
精彩评论