我在 PyCharm 中无法使用 import curses
。我不知道问题出在哪里。我应该怎么做?
我已经在命令行中运行了 python -m pip install windows-curses
,但包含'import curses'的代码仍然报错。它说找不到名为curses的模块。
import random
import curses
s = curses.initscr()
curses.curs_set(0)
sh, sw = s.getmaxyx()
w = curses.newwin(sh, sw, 0, 0)
w.keypad(1)
w.timeout(100)
snk_x = sw//4
snk_y = sh//2
这是输出错误:
File "C:/Users/USER/PycharmProjects/snake/snake1", line 2, in <module>
import curses
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'