Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ImportError:没有名为'_诅咒';当尝试导入祝福时_Python_Windows_Module_Curses_Python Curses - Fatal编程技术网

Python ImportError:没有名为'_诅咒';当尝试导入祝福时

Python ImportError:没有名为'_诅咒';当尝试导入祝福时,python,windows,module,curses,python-curses,Python,Windows,Module,Curses,Python Curses,我正在尝试运行以下命令: 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.') 这是这里的第一个示例: 但是,我得到了这个错误: Traceba

我正在尝试运行以下命令:

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.')
这是这里的第一个示例:

但是,我得到了这个错误:

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'
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“C:\Users”\�����\AppData\Local\Programs\Python\Python35-32\lib\site packages\behavigations\\ uuuuuuu init\uuuuuuuuu.py”,第5行,在
进口诅咒
文件“C:\Users”\�����\AppData\Local\Programs\Python\Python35-32\lib\curses\\uuuu init\uuuu.py”,第13行,在
从_诅咒导入*
ImportError:没有名为“\u curses”的模块
我的系统是win10 x64。

Windows计算机不支持该模块。从模块文档中:

虽然curses在Unix环境中使用最广泛,但版本是 可用于DOS、OS/2,也可用于其他系统。这 扩展模块的设计与ncurses的API相匹配,ncurses是一个 Linux和的BSD变体上托管的开源curses库 Unix


请从安装非官方的windows二进制文件以用于诅咒,然后重试。

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

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


同时-Windows 10上的Python 2.7.15-可通过以下方式添加对诅咒的支持:

pip install windows-curses

首先像这样使用pip安装诅咒 打开命令提示符

键入“pip安装windows curses”(仅当pip安装在环境变量中时才有效)

如果使用Pycharm运行curses不起作用,请尝试其他解释器应用程序,如Atom、Visual Studio,如果不起作用,请在环境变量中安装Python(链接位于底部)。然后启动CMD或命令提示符并键入“python(.py文件的根)” (例如python C:\Users\user\Plane.py),然后按enter键


用于在环境变量中安装Python的链接-

您只需下载该库即可

pip install windows-curses

在Windows上试试这个实现。我在Windows 7上也有同样的问题,我正在寻找解决办法。自述文件中提到在Windows上使用的
colorama
,这意味着该库在Windows上可以正常工作。我对Python有点陌生,所以我不确定在try/except构造中包装import语句是否是一种有效的方法,但我正在研究它。此外,仅供参考,我可以确认称为“祝福”的“祝福”分支具有相同的问题(v1.6)。@AdamP update,该模块的自述文件与“祝福”模块的自述文件有一个稍微不同的语句,该语句明确表示该模块在Windows命令提示符下不工作:“有福不提供。。。Windows命令提示符支持。python for windows的PDCurses构建目前只提供部分支持——有计划与ansi模块和colorama合并以解决这一问题。欢迎光临!“@eryksun您如何运行该实现?您是指如何安装控制盘软件包?使用
pip install curses-2.2-cp35-none-win32.whl
或您尝试安装的控制盘的任何文件名。这是否意味着我无法在Windows上使用祝福库?此外,这对我在运行Py的Windows 10上很有效thon 3.5.3在Windows 7运行CPython 3.7.4的情况下为我工作。thon 3.5.3在控制台中工作,在大多数IDE(如PyCharm)中失败。