Search code examples
pythoncurses

Python 3.7.3, win10, No module named '_curses'


It's my first time trying to use curses, after successfully installing it with python -m pip install windows-curses, (re-runing this code gives Requirement already satisfied: windows-curses in c:\python\python37-32\lib\site-packages (2.1.0)).

I ran the sample code:

import curses
import time

screen = curses.initscr()
screen.clear()
time.sleep(3)

And got the error:

ModuleNotFoundError                       Traceback (most recent call last)
c:\Users\Cris\Desktop\test.py in 
----> 1 import curses
      2 import time
      3 screen = curses.initscr()
      4 screen.clear()
      5 time.sleep(3)

~\Anaconda3\lib\curses\__init__.py in 
     11 """
     12 
---> 13 from _curses import *
     14 import os as _os
     15 import sys as _sys

ModuleNotFoundError: No module named '_curses'

which says curses is not installed...?

I ran this using VSC's Python Interactive tab (shift+enter), simply running it through VSC gives:

LINES value must be >= 2 and <= 132: got 13682
initscr(): Unable to create SP

Solution

  • Python for Windows doesn't come with curses.go to curses, download the version of curses that corresponds to your Windows and version of Python, and then pip install the whl file with python