我在我的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。这可以称为 bug…
好吧,我研究了一下 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上进行手动搜索帮助找到了Python的UniCurses。
但是,UniCurses 1.2安装程序无法在我的Windows注册表中找到任何Python安装(Python 2.7.9和Python 3.4.2可用)。
我还研究了公共域Curses(PDCurses)。PD Cureses 3.4是从2008年底开始的。所以它已经7年了。我不相信它会在Windows 7、Windows 8.1或Windows 10上运行。
是否有办法在Windows上使用Python运行curses。
(Windows Python,不是CygWin Python!)