2013-06-14 10 views
9

मैं पाइथन 2.7 के साथ मैक ओएस एक्स माउंटेन शेर चला रहा हूं। मैंने पिगलेट का एक स्रोत इंस्टॉल किया जो त्रुटियों के बिना जाना प्रतीत होता था, लेकिन जब भी मैं प्रोग्राम चलाने की कोशिश करता हूं तो मुझे एक लंबी त्रुटि मिलती है जिसे मैं समझ नहीं पा रहा हूं। ऐसा लगता है जैसे क्विकटाइम के साथ कुछ करना है ??पायगलेट का उपयोग करने की कोशिश कर रहा है - इस त्रुटि का क्या अर्थ है?

मैंने जो भी प्रोग्राम किया है, वही त्रुटि देता है। 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 
+1

मुझे लगता है कि @ user1740200 का उत्तर समाधान के रूप में स्वीकार करने योग्य है, क्योंकि यह वर्तमान में काम करता है। –

उत्तर

2

मैंने किया था कुछ और Googling, और अंततः एक पेज में पाया गया कि इस त्रुटि को संबोधित करता है। जाहिर है समस्या यह है कि Pyglet 64-बिट आर्किटेक्चर पसंद नहीं है। ये निर्देश मेरे लिए यह तय: http://roguejs.com/2011-11-22/getting-pyglet-to-work-on-mac-osx-lion/

Getting pyglet to work on Mac OSX Lion

November 22, 2011 by roguejs

For those of you who wanted to start doing game development in Python and wanted to use pyglet for it, and you’re using Mac OSX Lion, you’ll most probably come across this 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 Do not fret – this is merely pyglet 1.1.4 choking on 64-bit architectures (interesting trivia: Pyglet 1.1.4 is currently using the Carbon API, while Pyglet 1.2 is supposed to be ported over to use Cocoa instead).

The easiest way to do this is to force python to go 32bit by typing this in your console:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes However, just to be safe, I’m going to go through the entire setup steps in case you find any problems with it. Here goes:

Step 1 – install Mercurial in your Mac

Go to Mercurial and download the latest binary for your Mac. Install it, and then open the terminal.

Step 2 – clone the pyglet repository

Create a directory (I did mine in ~/Projects/lib), and clone the pyglet repository into it:

hg clone https://pyglet.googlecode.com/hg/ pyglet

cd pyglet

Step 3 – build it

Now in this step, you can optionally switch to the cocoa-port branch and try it out. Didn’t work for me though.

Optional

hg checkout cocoa-port

Build it

python setup.py install

Step 4 – Force python into 32-bits

Once you’re done, force python into 32 bits with this command:

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes And that’s it! Try building your pyglet app now – they shouldn’t throw the same exception again.

+0

32-बिट्स पर पायथन को मजबूर करने की आवश्यकता नहीं है, नीचे दी गई पोस्ट देखें। ऐसा हो सकता है कि 'पायगलेट' भंडार में मैक ओएस एक्स –

10

ऊपर की ही तरह, अपने खुद के चाल सर्वश्रेष्ठ दिया था स्थापित करने। मैंने इस साइट पर मिले निर्देशों को अनुकूलित किया: http://twistedpairdevelopment.wordpress.com/2012/02/21/installing-pyglet-in-mac-os-x/

मुझे बस रिपोजिटरी से सीधे स्थापित करने के लिए पीआईपी का उपयोग करना था।

pip install hg+ https://pyglet.googlecode.com/hg/

जॉब हो गया।

+0

के लिए एक फिक्स शामिल था, मेरे लिए भी काम किया। 32-बिट पायथन को मजबूर करने की कोई आवश्यकता नहीं है। ध्यान दें कि भंडार क्लोनिंग में कुछ समय लग सकता है, जो 'पीआईपी' लटकने जैसा प्रतीत होता है। वैकल्पिक रूप से 'एचजी क्लोन' के साथ क्लोन करें और फिर 'python setup.py install'। –

संबंधित मुद्दे