Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the notebook kernel of jupyter

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report