It is first time I'm using python on mac. I installed Python 2.7.1 from python.org and then wxPython2.8-osx-unicode-py2.7
这是我第一次在mac上使用python,我在python.org上安装了python 2.7.1,然后是wxPython2.8-osx-unicode-py2.7。
(Mac OS X 10.6.6)
(Mac OS X 10.6.6)
I have no idea where they installed to, but anyway, that's what I get:
我不知道他们安装在哪里,但不管怎样,这就是我得到的:
Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module>
from wx._core import *
File "/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in <module>
import _core_
ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found. Did find:
/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no matching architecture in universal wrapper
>>>
2 个解决方案
#1
3
As FogleBird says, wxPython use 32-bit and Mac Python installer should offer both architectures. So invoking python with 32 bit should allow you to use it with no issue. to invoke Python in 32-bit
正如FogleBird所说,wxPython使用32位,Mac Python安装程序应该同时提供两种架构。因此,用32位调用python应该允许您在没有问题的情况下使用它。在32位中调用Python。
$ python2.7-32
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print wx.version()
2.8.12.1 (mac-unicode)
instead of just $ python
而不是只使用$ python。
#2
1
You need to use 32-bit Python to use wxPython.
您需要使用32位的Python来使用wxPython。
These binaries should work on all versions of OSX from 10.3.9 onwards on either PPC or i386 architectures. Since they use the Carbon API they are limited to running in 32-bit mode.
这些二进制文件应该从10.3.9开始,在PPC或i386架构上处理所有版本的OSX。因为它们使用的是碳API,所以它们只能在32位模式下运行。
#1
3
As FogleBird says, wxPython use 32-bit and Mac Python installer should offer both architectures. So invoking python with 32 bit should allow you to use it with no issue. to invoke Python in 32-bit
正如FogleBird所说,wxPython使用32位,Mac Python安装程序应该同时提供两种架构。因此,用32位调用python应该允许您在没有问题的情况下使用它。在32位中调用Python。
$ python2.7-32
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print wx.version()
2.8.12.1 (mac-unicode)
instead of just $ python
而不是只使用$ python。
#2
1
You need to use 32-bit Python to use wxPython.
您需要使用32位的Python来使用wxPython。
These binaries should work on all versions of OSX from 10.3.9 onwards on either PPC or i386 architectures. Since they use the Carbon API they are limited to running in 32-bit mode.
这些二进制文件应该从10.3.9开始,在PPC或i386架构上处理所有版本的OSX。因为它们使用的是碳API,所以它们只能在32位模式下运行。