我正在运行Mac OS X Mountain Lion,使用
Python 2.7.我做了一个Pyglet的源代码安装,似乎没有错误,但任何时候我尝试运行一个程序,我会收到一个我不明白的错误.听起来它与QuickTime有关系?
我尝试过的每个程序都提供相同的错误.我尝试运行的程序是源代码中的例子,例如:http://guzalexander.com/2012/08/17/playing-a-sound-with-python.html
我得到的错误说:
File "examples/media_player.py",line 44,in <module> from pyglet.gl import * File "/Library/Python/2.7/site-packages/pyglet/gl/__init__.py",line 510,in <module> import pyglet.window File "/Library/Python/2.7/site-packages/pyglet/window/__init__.py",line 1669,in <module> from pyglet.window.carbon import CarbonPlatform,CarbonWindow File "/Library/Python/2.7/site-packages/pyglet/window/carbon/__init__.py",line 69,in <module> framework='/System/Library/Frameworks/QuickTime.framework') File "/Library/Python/2.7/site-packages/pyglet/lib.py",line 90,in load_library return self.load_framework(kwargs['framework']) File "/Library/Python/2.7/site-packages/pyglet/lib.py",line 226,in load_framework lib = ctypes.cdll.LoadLibrary(realpath) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",line 431,in LoadLibrary return self._dlltype(name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",line 353,in __init__ self._handle = _dlopen(self._name,mode) 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
解决方法
与上述类似,安装我自己的做法最好.我修改了我在本网站发现的说明:
http://twistedpairdevelopment.wordpress.com/2012/02/21/installing-pyglet-in-mac-os-x/
我只需要使用pip直接从存储库安装.
pip install hg+07001
任务完成.