1

I can run codes in terminal by manually typing "python example.py" and press enter.

But I can't run them by clicking 'Run' button or Shift + F10

The error message I get say that the modules I've imported are absent.

I can see the red underlines under the names of the modules that I've installed through pip.

enter image description here

I can still run them in terminal, so I'm able to manage to develop. but it's kinda annoying to type in terminal every time I want to test a code.

How can I solve this?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • Did you set "run configurations" and are you using a venv? Try [the official documentation](https://www.jetbrains.com/help/pycharm/creating-and-editing-run-debug-configurations.html). This [thread](https://stackoverflow.com/q/19679150) and [this thread](https://stackoverflow.com/q/11725519) may help. – bad_coder Feb 02 '21 at 02:26
  • Did you set your python interpreter on PyCharm? – Star Man Feb 02 '21 at 02:30
  • Yes, I can see it's Python 3.8 in configuration. – hog90160720 Feb 02 '21 at 02:35

1 Answers1

1

I have had this problem, did you install the modules through pycharm's venv or the terminal because you have to install it in the venv's terminal

Yash
  • 391
  • 3
  • 14
  • 1
    thanks a lot!!! I installed the modules through terminal, like 'python -m pip install', i think that was the problem – hog90160720 Feb 02 '21 at 02:54