'PyDevTerminalInteractiveShell' 对象没有属性 'has_readline' [英] 'PyDevTerminalInteractiveShell' object has no attribute 'has_readline'
问题描述
我在 CentOS7
上使用 Pycharm
2016.1
并且我正在测试Show command line after
"我遇到了这个问题:
I am using Pycharm
2016.1
on CentOS7
and I am testing "Show command line afterwards
" and I got this Problem:
AttributeError: 'PyDevTerminalInteractiveShell' object has no attribute 'has_readline'
/usr/bin/python3.4 /usr/local/pycharm/helpers/pydev/pydev_run_in_console.py 37196 52554 /root/PycharmProjects/mytf/mytest/test5.py
Traceback (most recent call last):
File "/usr/local/pycharm/helpers/pydev/pydev_run_in_console.py", line 63, in <module>
interpreter = InterpreterInterface(host, int(client_port), threading.currentThread())
File "/usr/local/pycharm/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 26, in __init__
self.interpreter = get_pydev_frontend(host, client_port, show_banner=show_banner)
File "/usr/local/pycharm/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 473, in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd(show_banner=show_banner)
File "/usr/local/pycharm/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 303, in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "/usr/lib/python3.4/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/usr/lib/python3.4/site-packages/IPython/terminal/interactiveshell.py", line 359, in __init__
super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
File "/usr/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 487, in __init__
self.init_completer()
File "/usr/local/pycharm/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 222, in init_completer
self.Completer = self._new_completer_200()
File "/usr/local/pycharm/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 194, in _new_completer_200
use_readline=self.has_readline,
AttributeError: 'PyDevTerminalInteractiveShell' object has no attribute 'has_readline'
推荐答案
出现此 PyCharm 问题是因为将 iPython
api 更改为 iPython
版本 5.直到 Jetbrains 修复这一点,恢复到较早版本的 iPython
(版本 4)将更正此问题.正如@chenfei 发现的,这可以通过 pip
来完成:
This PyCharm issue occurs because of changes the the iPython
api with iPython
version 5. Until Jetbrains fix this, reverting to an earlier version of iPython
(version 4) will correct this. As @chenfei has discovered, this can be done through pip
:
$ pip uninstall ipython
$ pip install ipython==4.2.0
编辑
如果你等不了那么久,Jetbrains 已经发布了一个补丁
And if you can't wait that long, Jetbrains have released a patch
https://youtrack.jetbrains.com/issue/PY-20013#comment=27-1512407
最终编辑
此问题已在 PyCharm 2016.2 中修复
This issue has been fixed in PyCharm 2016.2
这篇关于'PyDevTerminalInteractiveShell' 对象没有属性 'has_readline'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!