简体   繁体   English

Select python kernel 适用于 Jupyter 笔记本

[英]Select python kernel for Jupyter notebook

This is a basic beginner question.这是一个基本的初学者问题。

I have a python Jupyter notebook, when <Enter><Shift> is used, the focus goes to the top of the screen where the message is Select kernel for 'D:/...' Under this is the message: "Install kernels from the marketplace."我有一个 python Jupyter 笔记本,当使用<Enter><Shift>时,焦点会转到屏幕顶部,其中消息为Select kernel for 'D:/...'是消息:“安装内核来自市场。” There is no other visible message to explain what that means or what I am missing.没有其他可见的消息来解释这意味着什么或我遗漏了什么。

Steps to solve.解决步骤。

In one document, it mentioned that VSC should be opened using code from a [conda] environment where python is installed and there is a kernel. This required the following code in my environment在一份文件中,它提到应该使用安装了 python 的 [conda] 环境中的code打开 VSC,并且有一个 kernel。这需要在我的环境中使用以下代码

activate conda environment edw激活 conda 环境 edw

conda activate edw

Next install a kernel接下来安装一个kernel

 ipython kernel install --name "edw" --user

Verify the kernels验证内核

jupyter kernelspec list

result结果

 edw              C:\Users\hnelson3\AppData\Roaming\jupyter\kernels\edw

Start VSC启动 VSC

code

Next I open a notebook and put my cursor in a code block.接下来,我打开笔记本并将我的 cursor 放入代码块中。

<Enter><Shift>

The message Select kernel for 'D:/...' appears.出现Select kernel for 'D:/...' What is the next step?你下一步怎么做?

Thanks.谢谢。

在此处输入图像描述

在此处输入图像描述

I had that message 'Select kernel for 'D:/...' appearing as well when I first tried to run a jupyter notebook in VS code.当我第一次尝试在 VS 代码中运行 jupyter notebook 时,我也收到了消息“Select kernel for 'D:/...'”。 Turns out I had to install and enable the jupyter extension ( https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter ) and the python extension ( https://marketplace.visualstudio.com/items?itemName=ms-python.python ) as according to these instructions from https://code.visualstudio.com/learn/educators/notebooks :结果我必须安装并启用 jupyter 扩展( https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter )和 python 扩展( https://marketplace.visualstudio.com/items?itemName =ms-python.python )根据https://code.visualstudio.com/learn/educators/notebooks中的这些说明:

"You will need to have Python 3 installed on your machine along with the Microsoft Python extension installed from the VS Code Marketplace... “您需要在计算机上安装 Python 3 以及从 VS Code Marketplace 安装的 Microsoft Python 扩展...

In addition, you need to install the Jupyter Notebooks extension...此外,您需要安装 Jupyter Notebooks 扩展...

Once you have Python and the extensions installed, you will need to activate the Python environment by using the command Python: Select Interpreter from the Command Palette (Ctrl+Shift+P)."一旦安装了 Python 并安装了扩展,您将需要使用命令 Python 激活 Python 环境:Select 命令面板中的解释器 (Ctrl+Shift+P)。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM