导入错误: 尝试导入祝福时找不到名为'_curses'的模块

2024-10-16 20:40:13 发布

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

我正试着运行这个:

from blessings import Terminal

t = Terminal()

print (t.bold('Hi there!'))
print (t.bold_red_on_bright_green('It hurts my eyes!'))

with t.location(0, t.height - 1):
    print ('This is at the bottom.')

这是这里的第一个例子:https://pypi.python.org/pypi/blessings

但是,我得到这个错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\�����\AppData\Local\Programs\Python\Python35-     32\lib\site-packages\blessings\__init__.py", line 5, in <module>
    import curses
  File "C:\Users\�����\AppData\Local\Programs\Python\Python35-32\lib\curses\__init__.py", line 13, in <module>
    from _curses import *
ImportError: No module named '_curses'

我的系统是win10 x64。


Tags: infromimportpypilocallineusersappdata
3条回答

这是windows上的已知错误。它已经开了5年了,所以不要屏住呼吸。

非正式的curses构建是不够的,因为它还需要fcntl,这不太可能在短期内被移植。

同时-Python 2.7.15 on Windows 10-curses支持可以通过以下方式添加:

pip install windows-curses

Windows计算机不支持^{}模块。从模块文档中:

While curses is most widely used in the Unix environment, versions are available for DOS, OS/2, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix.

here安装curses的非官方windows二进制文件,然后重试。

相关问题 更多 >