【发布时间】:2016-06-21 09:27:34
【问题描述】:
我正在尝试运行这个:
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。
【问题讨论】:
-
试试这个curses Windows 实现。
-
我在 Windows 7 上遇到了同样的问题,正在寻找解决方法。自述文件中提到
colorama在 Windows 上使用的部分意味着该库以某种方式在 Windows 上工作。我对 Python 有点陌生,所以我不确定将 import 语句包装在 try/except 构造中是否是一种有效的方法,但我正在研究它。另外,仅供参考,可以确认blessings的分支blessed也有同样的问题(v1.6)。 -
@AdamP 更新,
blessed模块的自述文件与祝福模块的声明略有不同,它明确表明该模块在 Windows 命令提示符下不起作用:“祝福不提供... Windows 命令提示符支持。Windows 的 Python 的 PDCurses 构建目前仅提供部分支持 - 计划与 ansi 模块合并与 colorama 一起解决此问题。欢迎使用补丁!" -
@eryksun 您如何让该实现运行?
-
你的意思是如何安装wheel包?使用
pip install curses‑2.2‑cp35‑none‑win32.whl或您要安装的轮子的任何文件名。
标签: python windows module curses python-curses