【问题标题】:AttributeError: module 'readline' has no attribute 'set_completer_delims'AttributeError:模块“readline”没有属性“set_completer_delims”
【发布时间】:2018-12-06 08:36:22
【问题描述】:
    >>> import pdb
    >>> x = [1,2,3,4,5]
    >>> y = 6
    >>> z = 7
    >>> r1 = y+z
    >>> r1
    13
    >>> r2 = x+y
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: can only concatenate list (not "int") to list
    >>> pdb.set_trace()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.6/pdb.py", line 1585, in set_trace
        Pdb().set_trace(sys._getframe().f_back)
      File "/usr/lib/python3.6/pdb.py", line 156, in __init__
        readline.set_completer_delims(' \t\n`@#$%^&*()=+[{]}\\|;:\'",<>?')
    AttributeError: module 'readline' has no attribute 'set_completer_delims'
    >>>

什么问题?运行python3.6出现错误 我只是尝试在 Cygwin 上使用 pdb。 (注意其他lib都可以)

【问题讨论】:

    标签: python-3.x readline


    【解决方案1】:

    在我的情况下,问题是通过安装 pyreadline 解决的:

    pip install pyreadline
    

    请试一试。

    更多信息:https://github.com/winpython/winpython/issues/544

    【讨论】:

    • 不幸的是,这不是在 lldb 中的 python 脚本中使用 pdb 并出现相同错误的解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-14
    • 2019-02-18
    • 1970-01-01
    • 2020-01-01
    • 2019-07-20
    • 2021-11-05
    相关资源
    最近更新 更多