属性错误:模块“内置”没有属性“解释器”

问题描述 投票:0回答:3

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

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

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

下面是堆栈跟踪

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
python pycharm
3个回答
2
投票

此问题在您提出问题几天后已修复:https://youtrack.jetbrains.com/issue/PY-29313
您应该将 PyCharm 更新到 2018.1.1 或更高版本。


2
投票

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


0
投票

我在 PyCharm 2022.3.3(专业版)上也有同样的 版本 #PY-223.8836.43,建于 2023 年 3 月 10 日

© www.soinside.com 2019 - 2024. All rights reserved.