Add new virtual environment to the kernel of Jupyter Notebook

Recently, when building the environment, I found that the kernel of Jupyter Notebook only has basic python and pytorch. Now I want to use a new virtual environment in Jupyter Notebook.

Here's how to fix it:

(1) First activate the virtual environment in Anaconda Prompt. For example, the name of the environment I want to activate here is MindSpore

activate MindSpore

Replace the red part with your own virtual environment 

(2) pip install ipkernel:

pip install ipykernel

This part is relatively slow when I am downloading, you can try changing the hotspot of your mobile phone. 

(3) Enter the following command to add the current environment to the kernel of Jupyter Notebook.

The first part marked in red is the name of the virtual environment, which must be consistent with the name of the created virtual environment.

The second part marked in red is the display name in jupyter notebook, which can be named according to your preference:

python -m ipykernel install --user --name MindSpore --display-name "MindSpore(2.0.0)"

(4) Open Jupyter Notebook again 

Now you can see that the new virtual environment has been added successfully.

Guess you like

Origin blog.csdn.net/m0_62919535/article/details/131530159