Pyglet is a common requirement for many Python applications, a major one being Cocos2D.
But it doesn’t work out of the box. Running a Pyglet application will result in the following error:
OSError: dlopen(/System/Library/Frameworks/QuickTime.framework/QuickTime, 6): no suitable image found. Did find: /System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture /System/Library/Frameworks/QuickTime.framework/QuickTime: mach-o, but wrong architecture
The following are the steps to take to get Pyglet and PyObjc installed on OS-X (tested with 10.7 Lion).
Pyglet 1.1 uses the Carbon framework, but this is not compatible with 64-bit Python installs. The Pyglet 1.2 branch has been modified to use Quartz, but no releases of this branch have seen the light of day (sigh). We must instead install Pyglet from the Mercurial repository.
The Quartz bindings require the use of PyObjc but the latest versions do not work with Pip. The patches to PyObjc’s setup.py that I’ve seen on the internet do not work for me. The following is the only method I’ve had work.
Remove any existing Pyglet install
pip uninstall pyglet
Install Pyglet from the repository
pip install hg+https://pyglet.googlecode.com/hg/
Edit: The following is no longer needed
We need to install PyObjc for the new Pyglet Quartz API. But PyObjc is horribly broken and the latest version does not install with Pip or easy_install.
We must instead install an older version.
pip install pyobjc==2.2
You should now have a working Pyglet installation.