Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run wxPython on Lion

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.

like image 776
Jajajayja Avatar asked Aug 04 '11 18:08

Jajajayja


2 Answers

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

like image 151
Mike Driscoll Avatar answered Nov 10 '22 06:11

Mike Driscoll


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.

like image 25
KurtR Avatar answered Nov 10 '22 05:11

KurtR