Installing Pyglet in Mac OS X
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/
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.
2012/03/04 at 3:54 pm
Thank you for posting this. I’ve been trying to get Pyglet to run on Lion and having a terrible time.
2012/03/04 at 5:14 pm
Me too =P
I actually gave up last time.
Glad to have helped =)
Cheers,
Adam
2012/03/09 at 5:03 am
Worked like a charm. Thanks for posting this.
2012/07/02 at 4:03 pm
Thank you!
2013/04/10 at 1:10 am
what is pip i keep getting an error that is is an unknown command