AttributeError:模块'builtins'没有属性'interpreter'

时间:2018-04-07 08:13:46

标签: python pycharm

这是一个基本问题,我想。 我可以在Pycharm 2018.1 Python 3.6.5中运行我的程序。但是当我在调试模式下运行并打开python控制台时,当我尝试键入任何python命令时,我收到此错误消息。

我正在使用virtualenv并在项目设置中添加了解释器。

我想知道我的配置有什么问题

下面的

是stacktrace

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 362, in get_interpreter
    interpreterInterface = getattr(__builtin__, 'interpreter')
AttributeError: module 'builtins' has no attribute 'interpreter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1443, in do_it
    result = pydevconsole.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 467, in console_exec
    need_more =  exec_code(CodeFragment(expression), updated_globals, frame.f_locals, dbg)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 383, in exec_code
    interpreterInterface = get_interpreter()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 364, in get_interpreter
    interpreterInterface = InterpreterInterface(None, None, threading.currentThread())
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console.py", line 24, in __init__
    self.interpreter = get_pydev_frontend(host, client_port)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 461, in get_pydev_frontend
    _PyDevFrontEndContainer._instance = _PyDevFrontEnd()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 310, in __init__
    self.ipython = PyDevTerminalInteractiveShell.instance()
  File "/Users/hobart/envs/pys/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users/hobart/envs/pys/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 430, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "/Users/hobart/envs/pys/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 516, in __init__
    self.init_completer()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 234, in init_completer
    self.Completer = self._new_completer_500()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 196, in _new_completer_500
    parent=self
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py", line 87, in __init__
    self.matchers.remove(self.python_matches)
ValueError: list.remove(x): x not in list

2 个答案:

答案 0 :(得分:1)

尝试将某些软件包安装到虚拟环境后,我遇到了完全相同的问题。对我来说,它是通过重建环境来解决的。

答案 1 :(得分:1)

问题发生几天后,问题已得到解决:https://youtrack.jetbrains.com/issue/PY-29313
您应该将PyCharm更新为2018.1.1或更高版本。