“no matching architecture in universal wrapper” problem in wxPython?

后端 未结 5 1616
陌清茗
陌清茗 2020-12-09 19:04

I am running Python 2.7 under Mac OS 10.6.4, and I just installed wxPython from the wxPython2.8-osx-unicode-2.8.11.0-universal-py2.7.dmg binary. I am getting a

相关标签:
5条回答
  • 2020-12-09 19:32

    Just to clarify 'Ned Deily's' suggestion re: use arch -i386 python2.7 script.py to run in 32-bit mode. The exact command line is arch -i386 python pywrap spare.py. This will allow you to run PyCrust (in 32-bit mode on OSX 10.6.x).

    0 讨论(0)
  • 2020-12-09 19:35

    There's now a developmental release with 64-bit Cocoa support at http://downloads.sourceforge.net/wxpython/wxPython2.9-osx-2.9.4.0-cocoa-py2.7.dmg found at this page: http://www.wxpython.org/download.php#stable

    That worked for me.

    0 讨论(0)
  • 2020-12-09 19:39

    It appears that C extension modules included with the wxPython 2.7 dmg here are 32-bit only.

    $ cd /usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx
    $ file *.so
    _animate.so:   Mach-O universal binary with 2 architectures
    _animate.so (for architecture ppc): Mach-O bundle ppc
    _animate.so (for architecture i386):    Mach-O bundle i386
    _aui.so:       Mach-O universal binary with 2 architectures
    _aui.so (for architecture ppc): Mach-O bundle ppc
    _aui.so (for architecture i386):    Mach-O bundle i386
    ...
    

    Unfortunately, platform.architecture() does not give an accurate indication of which arch an OS X multiple architecture Python is running in. For example, using the 3-arch python.org installer for Python 2.7, platform.architecture() always reports 64-bit even when running in 32-bit mode:

    $ cd /Library/Frameworks/Python.framework/Versions/2.7
    $ file python2.7
    python2.7: Mach-O universal binary with 3 architectures
    python2.7 (for architecture i386):  Mach-O executable i386
    python2.7 (for architecture ppc7400):   Mach-O executable ppc
    python2.7 (for architecture x86_64):    Mach-O 64-bit executable x86_64
    $ arch -x86_64 ./python2.7 -c 'import platform, sys; print "{0}, {1:x}".format(platform.architecture()[0], sys.maxint)'
    64bit, 7fffffffffffffff
    $ arch -i386 ./python2.7 -c 'import platform, sys; print "{0}, {1:x}".format(platform.architecture()[0], sys.maxint)'
    64bit, 7fffffff
    $ arch -ppc ./python2.7 -c 'import platform, sys; print "{0}, {1:x}".format(platform.architecture()[0], sys.maxint)'
    64bit, 7fffffff
    

    The reliable way is to examine sys.maxint for Python 2 or sys.maxsize for Python 3.

    You don't indicate in your question how you invoke Python. Is it via a shebang line in a script file? If so, you may not be running the Python you think you are. Also, you don't indicate which Python 2.7 you have installed. For instance, there are currently two installers for Python 2.7 from python.org: one supports both 32- and 64-bit execution, the other is 32-bit only. Try the following:

    $ file $(python2.7 -c 'import sys;print(sys.executable)')
    /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: Mach-O universal binary with 3 architectures
    /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (for architecture i386):   Mach-O executable i386
    /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (for architecture ppc7400):    Mach-O executable ppc
    /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (for architecture x86_64): Mach-O 64-bit executable x86_64
    

    So: if you have a multi-arch version of Python, you'll need to force it to run in 32-bit mode to make use of the pre-compiled wxPython.

    0 讨论(0)
  • 2020-12-09 19:39

    How have you installed python on Snow Leopard OSX (10.6) Series? Is your python compiled for 64 bit or 32 bit.

    Try doing the following:

    import platform
    print platform.architecture()
    

    Check out if the binary (wxpython dmg) was compiled for 32 or 64 bit. You might have to look for a package that is compatible with your architecture or you might have to compile from source on your machine.

    I would suggest that you use macports.

    1. install macports from macport.org
    2. sudo /opt/local/bin/port install python27
    3. sudo /opt/local/bin/port install python_select
    4. sudo /opt/local/python_select python27
    5. sudo /opt/local/bin/port install py27-wxpython

    and this should work for you!

    0 讨论(0)
  • 2020-12-09 19:43

    There are two files for 32bit system, python2.7-32 and pythonw2.7-32. You can use these two files to run your script.

    I link python to the python2.7-32 and link pythonw to the pythonw2.7-32. My scripts all are working well.

    you can try.

    0 讨论(0)
提交回复
热议问题