-1

I get the error ModuleNotFoundError: No module named '_curses' every time I try to uses curses in VS Code or PyCharm.

But it works in the command prompt (I'm on Windows BTW)

Code is from Tech With Tim tutorial:

import curses
from curses import wrapper
import queue
import time



def main(stdscr):
    stdscr.clear()
    stdscr.addstr(0, 0, 'Hello world')
    stdscr.refresh()
    stdscr.getch()


wrapper(main)
Freddy Mcloughlan
  • 4,129
  • 1
  • 13
  • 29
Luke
  • 1

2 Answers2

1

If it works in command prompt, you may need to fix your environment to use the correct Python version. Try:

  1. Installing curses:
pip install windows-curses

Or for Python 3 explicitly

pip3 install windows-curses
  1. Configure your VS-Code interpreter. Open VS code and click cmd/ctrl + shift + p then type select python interpreter and click on the correct one. I'm not sure how to do this on Pycharm
Freddy Mcloughlan
  • 4,129
  • 1
  • 13
  • 29
1

If you use Pycharm an environment is used to manage your librarys. To install curses go to settings, Python Interpreter and then an the plus, like this: enter image description here

Then install curses

Poder Psittacus
  • 94
  • 1
  • 10