I'm having some trouble getting wxpython working on my mac. Here is a link to a tutorial that I am using: https://realpython.com/python-gui-with-wxpython/#getting-started-with-wxpython
The error message I am receiving is on the import of wx: || receiving ModuleNotFoundError: No module named 'wx' ||
I have also tried import wxpython as wx, in case that was an issue. No luck.
I have done some reading on the wxpython.org gitHub and readme, perhaps I missing some dependencies? Here is the prerequisites page: https://github.com/wxWidgets/Phoenix/blob/master/README.rst#prerequisites
They mention some sort of a build and wheel here: https://github.com/wxWidgets/Phoenix/blob/master/README.rst#id2
I consider myself a little more experienced than a beginner at this stuff, but I have never read or heard of such terms above. The most work I have had to do to import some non-standard library was pip3 install x.
import wx
app = wx.App()
frame = wx.Frame(parent=None, title='Hello World')
frame.Show()
app.MainLoop()
Expected result: a blank window with title "Hello World" Actual result: error on line 1... ModuleNotFoundError: No module named 'wx'
Uninstall using the same pip / pip3 tools, and then use this:
$ python -m pip install wxpython
The -m module syntax ensures that sys.path has the same value during installation as it will at runtime.
If still no joy, then first figure out where the binary wheel got installed to:
$ mdfind wx | egrep '/wx$'
or
$ find ~/miniconda3 ~ /usr / -name wx
(Hit CTRL-C once found.)
Then see if your path is searching in the right place:
$ echo $PYTHONPATH
$ which python
$ python
>>> import pprint
>>> import sys
>>> pprint.pprint(sys.path)
...
>>> import wx
>>>
The path is controlled by an env var.
Consider doing $ export PYTHONPATH=/some/dir before invoking the interpreter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With