python3, pycharm ModuleNotFoundError: No module named 'wx'
by kaz2100 from LinuxQuestions.org on (#5J7CA)
Hya,
Problem As title reads, ModuleNotFoundError: No module named 'wx'
System Debian amd64 testing. (pycharm is not debian package, downloaded from Jetbrains.com community version)
Situation Script chokes at "import wx" under pycharm, but not python interactive mode.
Troubleshooting I was somewhat confident that something is wrong with pycharm, so played around PYTHONPATH and venv setting without success. It turned out to be that wx is NOT under sys.path. It is under /usr/lib/python3, while sys.path has only /usr/lib/python3.9
Workaround Add Code:sys.path.append(r'/usr/lib/python3/dist-packages') works.
But, there must be some reason for these two distinct directories to exist (python3.9 and python3). So some adverse effect may happen in future. Hopefully not.
cheers
Closing remark May our penguins be happy!
Problem As title reads, ModuleNotFoundError: No module named 'wx'
System Debian amd64 testing. (pycharm is not debian package, downloaded from Jetbrains.com community version)
Situation Script chokes at "import wx" under pycharm, but not python interactive mode.
Troubleshooting I was somewhat confident that something is wrong with pycharm, so played around PYTHONPATH and venv setting without success. It turned out to be that wx is NOT under sys.path. It is under /usr/lib/python3, while sys.path has only /usr/lib/python3.9
Workaround Add Code:sys.path.append(r'/usr/lib/python3/dist-packages') works.
But, there must be some reason for these two distinct directories to exist (python3.9 and python3). So some adverse effect may happen in future. Hopefully not.
cheers
Closing remark May our penguins be happy!