Python 3.7.3,win10,没有名为“\u curses”的模块

2024-04-24 11:14:59 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我第一次尝试使用curses,在成功地用python -m pip install windows-curses安装它之后(重新运行这段代码会得到Requirement already satisfied: windows-curses in c:\python\python37-32\lib\site-packages (2.1.0))。你知道吗

我运行了示例代码:

import curses
import time

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

得到了错误:

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'

上面说没有安装诅咒。。。?你知道吗

我使用VSC的Python交互选项卡(shift+enter)运行它,只需通过VSC运行它就可以得到:

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

Tags: 代码inpyimporttimeoswindowslib
1条回答
网友
1楼 · 发布于 2024-04-24 11:14:59

Python for Windows没有附带诅咒。走要curses,请下载与您的Windows和Python版本相对应的curses版本,然后pip用Python安装whl文件

相关问题 更多 >