8
votes

I've just bought a new computer with Lion on it. I've downloaded and installed both Python 2.7 and wxPython 2.8 (for 2.7). I know Python comes with the system, but I rather go with the official one.

Anyway, upon typing "import wx" on the IDLE, I get the following message:

Traceback (most recent call last): File "", line 1, in import wx File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/init.py", line 45, in from wx._core import * File "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in import core ImportError: dlopen(/usr/local/lib/wxPython-unicode-2.8.12.1/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.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/core.so: no matching architecture in universal wrapper

I believe it happens because wxPython only supports 32-bit, but I can't figure out how to force python to run on 32-bit.

Anyone could help? Thank you in advance.

4

4 Answers

7
votes

wxPython 2.9 supports 64-bit on Mac too (see the Development version section and look for the cocoa build: http://wxpython.org/download.php). This was also discussed on the mailing list, and multiple users confirmed that wx works on Lion: https://groups.google.com/forum/#!searchin/wxpython-users/lion/wxpython-users/LvjSVqqMMpQ/U0QJXEeBpLQJ

1
votes

This may not work for python versions below 2.9. Running 'python' did not work for me...I am using 2.7 for compatibility. But figured out that 'python' may be an alias for a 64 bit mode and for some reason the arch command does not work.

So, here is what I have to use under Lion to get wx to work (this works for 2.6 or 2.7):

$ arch -i386 python2.7

Then when python loads:

import wx

works fine. You may have to call the specific python with the arch command, such as python2.7, or whatever version you are using.

0
votes

This should start it up in 32-bit mode, I'm not sure if it will fix the wx problem

% arch -i386 python                                                                                                                     
0
votes

You can force python to run in 32-bit mode by adding the following line to your shell profile

export VERSIONER_PYTHON_PREFER_32_BIT=yes