Unable to import wx (Python) on Mac OS X

This is the 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 OS X 10.6.6)

I have no idea where they are installed, but anyway, 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
>>> 
+3
source share
2 answers

As FogleBird says, wxPython uses 32-bit, and the Mac Python installer should offer both architectures. Thus, calling python with a 32-bit version should allow you to use it without a problem. to call Python in 32-bit

$ 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 $ python

+3
source

You need to use 32-bit Python to use wxPython.

OSX 10.3.9 PPC, i386. API- Carbon, 32- .

+1

Source: https://habr.com/ru/post/1787805/


All Articles