Ben
Ben

Reputation: 1849

Cant import wx using pycharm

Im using PyCharm and when I try to use wxPython im getting error.

right on the beginning of the file I get this:

import wx

ModuleNotFoundError: No module named 'wx'

I downloaded wxpython using pip.

Thank you.

Upvotes: 3

Views: 8906

Answers (2)

dorfuss
dorfuss

Reputation: 11

On Windows, click File menu, choose Settings -> Project -> Project Interpreter. The add button should be on the right side of the screen (v. 2018.2.4 Community).

Upvotes: 0

Glenn D.J.
Glenn D.J.

Reputation: 1965

My assumption here is that you installed wxpython outside of the virtual environment that you are using in your pycharm project.

So the solution is to install it in your virtual environment.

You can check your virtual environment in PyCharm -> Preferences -> Project -> Project Interpreter. There you can also press the + symbol at the bottom left to install wxpython there. (Which will basically pip install the package inside the virtualenv your project uses.)

Upvotes: 7

Related Questions