在 iPython/Jupyter 个笔记本中安装多个 Python 3 个内核

Installing multiple Python 3 kernels in iPython/Jupyter Notebooks

我的系统上有 Python 3.7 和 3.8。

我在 jupyter notebook 的 3.7 和 3.8 上都安装了 运行 pip,但是在尝试创建新笔记本时,内核列表只显示 "Python 3"

的一个值

如何让 Python 3.7 和 3.8 同时显示在这里?

你必须在jupyter上安装内核。 您可以在命令 prompt/bash 终端中执行此操作:

jupyter kernelspec list

这将为 jupyter notebooks return 当前安装的所有内核。

最好为您拥有的每个项目运行 一个虚拟环境。激活您的 venv,然后您可以使用此 bash 命令安装 Python 内核以在 jupyter notebook 中使用:

ipython kernel install --user --name=projectname

请注意,从 venv 外部安装的内核也可用于 jupyter。

您可以使用以下方法卸载内核:

jupyter kernelspec uninstall <name of kernel>

详情请看这里:https://ipython.readthedocs.io/en/stable/install/kernel_install.html

其中还有安装多个 python 内核而不使用虚拟环境的说明。