2010-11-23 89 views
3

我試圖在Mac 10.5.8和Python 2.6中運行/ Developer/Examples/Quartz/Python中的一些Quartz演示程序。但是,我收到錯誤,找不到CoreGraphics。在Mac OS上未找到CoreGraphics Python

Traceback (most recent call last): 
    File "circle.py", line 38, in <module> 
    from CoreGraphics import * 
ImportError: No module named CoreGraphics 

在看蘋果的文檔,這不應該是在烤? http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_python/dq_python.html#//apple_ref/doc/uid/TP30001066-CH218-TPXREF101

回答

4

CoreGraphics包裝由Apple提供,作爲Apple X提供的Python的一部分。由於OS X 10.5中沒有Apple提供的Python 2.6版本(Apple提供2.5和2.3),因此您必須使用非Apple版本,可能來自python.org安裝程序或MacPorts。他們不會有這個模塊。要麼切換到使用Apple提供的2.5版,要麼使用開放源代碼PyObjC Quartz bindings