Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure the notebook kernel of jupyter

Shulou Source: shulou.com Published: 2022-06-01 14:57:56 09月30日 Update

This article focuses on "how to configure the notebook kernel of jupyter". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to configure the notebook kernel of jupyter.

My jupyter-bootbook was obtained by installing anaconda under ubuntu, and most of the following commands can be run under Windows, but with a slight difference. It is still recommended to do AI development in the Linux environment.

Add Kernel

Create a new virtual environment and install python ipykernel

(base) fxyang@dl733:~$ conda create-n study python ipykernel

Activate the environment

(base) fxyang@dl733:~$ conda activate study (study) fxyang@dl733:~$

In the active environment, execute the following command to add the kernel

(study) fxyang@dl733:~$ python-m ipykernel install-- user-- name studyInstalled kernelspec study in / home/fxyang/.local/share/jupyter/kernels/study

Where study is the name that the corresponding kernel of the environment displays in notebook, which is generally recommended to be the same as the virtual environment name.

View the list of existing kernels (study) fxyang@dl733:~$ jupyter-kernelspec listAvailable kernels: study/ home/fxyang/.local/share/jupyter/kernels/study python3 / home/fxyang/Software/anaconda3/envs/study/share/jupyter/kernels/python3 rename kernel

Rename kernel of the study environment to study2

(study) fxyang@dl733:~$ cd / home/fxyang/.local/share/jupyter/kernels/study (study) fxyang@dl733:~/.local/share/jupyter/kernels/study$ vim kernel.json# change fields are as follows: "display_name": "study2"

Since then, the notebook core is shown in the following figure:

Note: the root directory of jupyter-notebook depends on the root directory where the jupyter-notebook command is executed. And this command can only be run in the base environment, because the jupyter-notebook tool is installed in the base environment.

Delete kernel (study) fxyang@dl733:~$ jupyter-kernelspec uninstall studyKernel specs to remove: study / home/fxyang/.local/share/jupyter/kernels/studyRemove 1 kernel specs [y RemoveKernelSpec]: y [RemoveKernelSpec] Removed / home/fxyang/.local/share/jupyter/kernels/study

Python3 this core points to when you activate the virtual environment, generally will not use the base environment as the development environment, a project, an environment.

At this point, I believe you have a deeper understanding of "how to configure the notebook kernel of jupyter". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Environment kernel command configuration activation content suggestion core root directory facet learning development running practical deeper same interest depends on name most Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Huawei Microsoft NVidia