Can not import wxPython (Mac)

how to install wxpython
wxpython not found
conda install wxpython
how to install wxpython in pycharm
brew install wxpython 3
install wx in mac
wxpython raspberry pi
could not import wx

I thought I'd move from using Tkinter to wxPython, but I'm having some troubles. All I get is this:

>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named wx

I have installed wxPython. When I run the uninstaller I clearly see that wxPython IS installed:

  1.  wxPython3.0-osx-cocoa-py2.7                 3.0.0.0

Enter the number of the install to examine or 'Q' to quit: 

When I start Python I see that my version should match the version of wxPython:

Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

I'm on OS X 10.7.5 32-bit.

Any help would be awesome! :)

Macs can have multiple versions of Python installed. Are you sure that you installed wxPython for the same python you invoke with the interpreter?

Try, which python, and make sure that this version of python has a wxredirect.pth file in site-packages pointing to the wxPython installation. (If it doesn't search for wxredirect.pth.)

Here's one version on my system...

> which python2.6
/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6

> more /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/wxredirect.pth
import site; site.addsitedir('/usr/local/lib/wxPython-3.0.0.0/lib/python2.6')
#import site; site.addsitedir('/usr/local/lib/wxPython-2.9.1.1/lib/python2.6')
#import site; site.addsitedir('/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.6')

Here, btw, I can comment out lines in the wxredirect.pth to choose the version of wxPython I want to use.

Can't import wx on MacOS - wxPython Users, Hi, Installed Python 3.7.4 on my MacBook but 3.7.4 but it won't import wx in a script. wxPython is installed because it will import wx into the� Creating Executables for Mac. While the same commands should work on Mac OSX as it does on Windows, I found that I needed to run the following command to generate a working executable: pyinstaller image_viewer_slideshow.py --windowed The output that PyInstaller generates will be slightly different and the result is an application file.

I just find the same problem. I used brew install wxpython to install it on mac. I try the method above but no use. I happen to find the solution when I install another package, it showen below:

   brew install tbb
   Downloading https://homebrew.bintray.com/bottles/tbb-2017_U7.sierra.bottle.t
   ############################################################ 100.0%
   ==> Pouring tbb-2017_U7.sierra.bottle.tar.gz
   ==> Caveats
   Python modules have been installed and Homebrew's site-packages is not
   in your Python sys.path, so you will not be able to import the modules
   this formula installed. If you plan to develop with these modules,
   please run:

   mkdir -p /Users/ningrongye/.local/lib/python2.7/site-packages
   echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-        
   packages")' >> /Users/ningrongye/.local/lib/python2.7/site-
   packages/homebrew.pth`

this is what homebrew said and I just try those, and it works.

ningrong

How to install wxPython, is available on the wxPython site, for both PPC and Intel Macs. package being "damaged and can't be opened", then you need to� Running a simple (windowed) wxPython Hello-World on macOS fails. It succeeds on Linux and on Windows (tested on Win7). Environment PyInstaller: tested with both 3.2 and 3.3.dev0+8892e11 (pip instal

I have Python 2.7 and 3.7 . In /usr/local/bin/ there are symbolic links for 2.7 and 3.7 Python versions and also symbolic links for pip.

I've installed wxPython with pip3

pip3 install -U wxPython

Then i checked the installation for Python3

myname$ python3
Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.version()
'4.0.4 osx-cocoa (phoenix) wxWidgets 3.0.5'

Antonio

wxPython Downloads, In fact, pip can also be told to just build the wheel and not do the install. to be aware of with the conda builds of wxPython is that on OSX/macOS you will need � Your root password is required here. Install wxGTK: make install. Link the library: ldconfig. Exit from superuser mode: exit. Normally, wxGTK is installed but there might be a problem with wxPython: it is possible that the library is not installed where wxPython is looking for it.

In my case it worked by resetting the brew environment to 2.7:

brew link --overwrite python@2

WxPython Install Issue on MacOS 10.14 with pyenv and python 3.8.0 , Otherwise, there really isn't anything that is Python version specific up to this point in the build. The messages above are coming from the� Getting Started With wxPython. The wxPython GUI toolkit is a Python wrapper around a C++ library called wxWidgets.The initial release of wxPython was in 1998, so wxPython has been around quite a long time. wxPython’s primary difference from other toolkits, such as PyQt or Tkinter, is that wxPython uses the actual widgets on the native platform whenever possible.

Module only installs to Python 2 and I can't access it from Python 3 , pip install -U wxPython. If you are on Windows or macOS with a compatible Python build, then the command shown above will download the� Just like "Classic" wxPython, Phoenix wraps the wxWidgets C++ toolkit and provides access to the user interface portions of the wxWidgets API, enabling Python applications to have a native GUI on Windows, Macs or Unix systems, with a native look and feel and requiring very little (if any) platform specific code.

How to Build a Python GUI Application With wxPython – Real Python, Each of these toolkits will work with Windows, macOS, and Linux, with PyQt having You can now use pip to install wxPython 4, which was not possible in the� Just like “Classic” wxPython, Phoenix wraps the wxWidgets C++ toolkit and provides access to the user interface portions of the wxWidgets API, enabling Python applications to have a native GUI on Windows, Macs or Unix systems, with a native look and feel and requiring very little (if any) platform specific code.

Can't Install wxPython with Homebrew � Issue #34799 � Homebrew , I'm a newbie to Homebrew (and to MacOS, really). If this is not an appropriate place to post this issue, I apologize, and ask that you direct me to the right place. A tarball containing the wxPython API documentation, which is the same content available at https://docs.wxpython.org. You can use this copy of the reference docs for local off-line reading of the API reference material. Look for a file named like wxPython-docs-VERSION.tar.gz. A tarball containing the wxPython demo and samples. It is highly

Comments
  • possible duplicate of Can't import wx(Python) on Mac OS X
  • Running python with the commands given in that post does not solve my problem.
  • wxpython on a Mac is a little bit of a nuisance, due to apple's pre-installed python. Are you sure that you are running the instance of python into which you installed wx?
  • Thank you for your answer. Where can I find site-packages? I searched in finder but found no such file. I'm really new to the whole coding thing, plus I've been on windows my entire life.
  • site-packages is a standard directory where packages not contained in the standard distribution are put (you should also have a site-packages directory in Windows, btw). Mine show up in the finder, but this might be due to Finder settings. Look on a path similar to mine: use which python, back up from that directory (to the directory above bin) and into lib, etc.