【发布时间】:2015-12-01 18:04:01
【问题描述】:
我在我的 Windows 7 (x64) 机器上安装了正在运行的 Python 2.7/3.4。我想在 Windows 上测试 curses。
Curses 已安装但无法正常工作:
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Tools\Python3.4.2\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ImportError: No module named '_curses'
因此,Python 3.4 的 Windows 安装程序安装了带有未解决依赖项的 curses。可以将其称为错误...
好的,我研究了 UniCurses。这是PDCurses 的包装器:
UniCurses 是 Python 2.x/3.x 的包装器,它在所有平台(MS Windows、Linux 和 Mac OS X)上提供了一组统一的 Curses 函数,其语法接近原始 NCurses。为了在 Microsoft Windows 系统上提供 Curses 功能,它封装了 PDCurses。
通过pip3 安装 UniCurses 会导致错误:
C:\Users\Paebbels>pip3 install UniCurses
Downloading/unpacking UniCurses
Could not find any downloads that satisfy the requirement UniCurses
Some externally hosted files were ignored (use --allow-external UniCurses to allow).
Cleaning up...
No distributions at all found for UniCurses
Storing debug log for failure in C:\Users\Paebbels\pip\pip.log
Python 的 UniCurses 站点上的 SourceForge 链接已失效。手动搜索 SourceForge 帮助再次找到 UniCurses for Python。
但是,UniCurses 1.2 安装程序在我的 Windows 注册表中找不到任何 Python 安装。 (Python 2.7.9 和 Python 3.4.2 可用)。
我还研究了公共领域诅咒 (PDCurses)。 PD Cureses 3.4 是从 2008 年底开始的。所以它已经 7 岁了。我认为它不适用于 Windows 7、Windows 8.1 或 Windows 10。
有什么方法可以让 curses 在 Windows 上使用 Python 运行。
(Windows Python,而不是 CygWin Python!)
【问题讨论】:
-
它可能可以工作,因为没有基本的不兼容问题——但是这样做,你将不得不学习如何修改 UniCurses(并构建 that )。
-
Christoph Gohlke 的 Windows 版本为 curses。下载 curses‑2.2‑cp34‑none‑win_amd64.whl 并按照说明发送至install a wheel。
-
@eryksun 请写下您的评论作为答案,以便我对其进行投票。安装很顺利。
-
您是否热衷于编写 curses 代码,或者您需要等效的 API?如果是后者,我已经为asciimatics 解决了所有这些相同的问题。该软件包将为您提供可在 Windows 7、8 和 10 上运行的跨终端 API,以及大量动画内容...
标签: windows python-3.x curses pdcurses