无法使用默认解释器

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

将解释器设置为 /usr/bin/python3 时,我在 Spyder 中收到以下错误消息:

An error ocurred while starting the kernel
The Python environment or installation whose interpreter is located at
    /usr/bin/python3
doesn't have the spyder‑kernels module or the right version of it installed (>= 2.4.0 and < 2.5.0). Without this module is not possible for Spyder to create a console for you.

You can install it by activating your environment first (if necessary) and then running in a system terminal:
    conda install spyder-kernels=2.4
or
    pip install spyder-kernels==2.4.*

使用 conda 或 pip 安装时,它表示已安装。

我该如何解决这个问题?

ubuntu spyder
1个回答
0
投票

Spyder 的 IPython 控制台 需要安装

spyder-kernels
软件包 - 这就是 Spyder 可以做的事情,比如向你显示变量的内容等等,据我所知。

如果您确实想从 Spyder 运行代码,但在没有间谍程序内核的 Python 解释器中,请转到 工具 > 首选项 > 运行,然后选择

Execute in a dedicated system terminal
。现在单击“运行”按钮将打开一个终端窗口来运行您的代码(如果您需要在代码完成后查看控制台输出,也请选择
Interact with the Python console after execution
)。

这使得此行为成为 Spyder 中所有 Python 文件的默认行为,或者您可以转到 Run > Configuration per file 为每个文件单独设置。

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