【问题标题】:how to correct AttributeError如何纠正 AttributeError
【发布时间】:2020-03-27 16:24:46
【问题描述】:

我已经导入了 ncurses,但它显示了这个错误

  Traceback (most recent call last):
  File "C:\Users\jai.best-PC\Desktop\the real snk game.py", line 1, in <module>
    import ncurses
  File "C:\Python27\lib\ncurses.py", line 8, in <module>
    import _curses
  File "C:\Python27\lib\_curses\__init__.py", line 59, in <module>
    import has_key
  File "C:\Python27\lib\_curses\has_key.py", line 11, in <module>
    _curses.KEY_A1: 'ka1',
AttributeError: 'module' object has no attribute 'KEY_A1'

为什么我在这里得到一个属性错误,而

 import _curses


_capability_names = {
    _curses.KEY_A1: 'ka1',

我在 has_key.py 模块中有它

【问题讨论】:

  • 你想做什么?您希望 KEY_A1 或 ka1 是什么?
  • 我正在尝试使用向上箭头、向下箭头等键盘字符。

标签: python attributes ncurses attributeerror curses


【解决方案1】:

由于您在 Windows 上,因此没有内置 python curses。
试试:

pip install windows-curses

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-09
    • 2015-02-25
    相关资源
    最近更新 更多