我在Windows 7(x64)机器上安装了运行的Python 2.7/3.4.我想在Windows上测试诅咒.

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'

documentation人说:

Windows版本的Python不包括curses模块.有一个名为UniCurses的移植版本可用.

因此,Python 3.4的Windows installer安装了带有未解析依赖项的诅咒.有人可以把这叫做虫子...

好吧,我查看了UniCourses.这是PDCurses美元的包装纸:

UniCourses是Python 2的包装器.x/3.它在所有平台(MS Windows、Linux和Mac OS x)上提供了一组统一的Curses函数,语法与最初的NCurses相近.为了在微软Windows系统上提供诅咒功能,它包装了PDCurses个.

通过pip3安装UniCourses会导致错误:

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的UniCourses站点上指向SourceForge的链接已失效.SourceForge通过手动搜索再次找到了UniCurses for Python个.

但是,UniCourses 1.2安装程序在我的Windows注册表中找不到任何Python安装.(可以使用Python 2.7.9和Python 3.4.2).

我还研究了公共领域的诅咒(PDCurses).PD治愈率3.4是从2008年底开始的.所以它已经7岁了.我不相信它能在Windows 7、Windows 8.1或Windows 10上运行.

Is there any way to get curses running on Windows with Python.

(Windows Python,而不是CygWin Python!)

推荐答案

如果手动安装Windows或其他软件包中的其他软件包,则可以跨平台(Windows、MacOS、GNU/Linux)使用curses.

  1. 安装车轮组件.如果你需要更多关于wheel click here的信息.

  2. this repository.

  3. 下载python版本的软件包,例如python 3.4:

    curses-2.2-cp34-none-win_amd64.whl
    
  4. 安装它(如果是windows,则此命令与其他软件包一样安装在GNU/Linux中)

    python -m pip install curses-2.2-cp34-none-win32.whl
    
  5. 只需在python脚本中包括:

    import curses 
    

可以使用python的诅咒包装器.在所有终端的Fedora 25中工作,在Windows 10中使用git bash、powershell或cmd.

更新:

  • Windows here中诅咒的替代品.
  • Windows here中的控制台用户界面.
  • 有趣的教程here.

Python-3.x相关问答推荐

Pandas :从元组字典创建数据帧

如何使用TensorFlow Keras子类化来构建和训练模型

regexp多重前瞻行为的解释

无法导入名称';核心';来自部分初始化的模块';tensorflow_datasets';(很可能是由于循环导入)

如何通过 python 使用 auth no priv 获取 SNMPv3?

根据按不同列中的值分组的平均值划分 DataFrame

它们是否同样存储在python3的内存中?

以不规则频率识别数据框日期时间列上缺失的日期,并用关联值填充它们

使用 python-binance 时,heroku [regex._regex_core.error: bad escape \d at position 7] 出错

Pytorch:图像标签

Python3 AttributeError:列表对象没有属性清除

具有函数值的 Python 3 枚举

Await Future 来自 Executor:Future 不能在await表达式中使用

解包时是否可以指定默认值?

TypeError:JSON 对象必须是 str,而不是 'dict'

如何从字典中打印特定键值?

Python 异步调试示例

Python3四舍五入到最接近的偶数

如何通过命令行将数组传递给python

使用 Python 3 读取 CSV 文件