更新后,Pycharm控制台无法连接

时间:2018-04-03 11:30:43

标签: python-3.x pycharm

我刚刚更新了Pycharm,除了出现以下错误的“Python控制台”外,一切正常:

“/ Applications / PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py”52830 52831

追踪(最近一次呼叫最后一次):

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py”,第526行,     pydevconsole.start_server(host,int(port),int(client_port),client_host)

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py”,第347行,在start_server中     interpreter = InterpreterInterface(client_host,client_port,threading.currentThread())

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console.py”,第24行, init     self.interpreter = get_pydev_frontend(host,client_port)

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py”,第461行,在get_pydev_frontend中     _PyDevFrontEndContainer._instance = _PyDevFrontEnd()

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py”,第310行, init     self.ipython = PyDevTerminalInteractiveShell.instance()

文件“/Users/kiarash/anaconda/lib/python3.6/site-packages/traitlets/config/configurable.py”,第412行,例如     inst = cls(* args,** kwargs)

文件“/Users/kiarash/anaconda/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py”,第430行, init     super(TerminalInteractiveShell,self)。 init (* args,** kwargs)

文件“/Users/kiarash/anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py”,第516行, init     self.init_completer()

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py”,第234行,在init_completer中     self.Completer = self._new_completer_500()

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py”,第196行,在_new_completer_500     父=自

文件“/ Applications / PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py”,第87行, init     self.matchers.remove(self.python_matches)

ValueError:list.remove(x):x不在列表中

使用退出代码1完成处理

2 个答案:

答案 0 :(得分:13)

已在GitHub上提交补丁(https://github.com/JetBrains/intellij-community/commit/d9f32f650b5a1f4e7a9646011da415d27e18a210

你也可以自己应用补丁,文件路径:

<PyCharm Root>/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py

修改:

     class PyDevIPCompleter(IPCompleter):

     def __init__(self, *args, **kwargs):
         """ Create a Completer that reuses the advanced completion support of PyDev
             in addition to the completion support provided by IPython """
         IPCompleter.__init__(self, *args, **kwargs)
         # Use PyDev for python matches, see getCompletions below
-        self.matchers.remove(self.python_matches)
+        if self.python_matches in self.matchers:
+            # `self.python_matches` matches attributes or global python names
+            self.matchers.remove(self.python_matches)

答案 1 :(得分:9)

我发现ipython就是问题所在 ipython(6.3.0)已更新,但如果你现在想使用pycharm,你应该降级到ipython(6.2.0)