In the process of working today, you encounter the problem of installing Anaconda using Conda to create a virtual environment, but after starting Jupyter notebook, you cannot find Python kernel in the virtual environment. Later on the internet found a solution, as follows:
Create a virtual environment
First look at the commands that created the virtual environment at that time:
create -n python2 python=2.7
Use this command to create a python2
virtual environment called.
Jupyter Notebook Add python kernel
Create a folder under/usr/local/anaconda3/share/jupyter/kernels/, preferably using the name of the virtual environment for easy identification.
Of course, you can also CP Python3-r Python2, and then modify the Python2 command path in the Kernel.json file.
Save, restart Jupyter notebook.
After restarting, it was found that there was a python2 kernel, but the kernel was never started. Later found to be a lack of ipykernel. Then use the following command to install:
install -n python2 ipykernel
So far, the problem has been solved.
If you often need to use jupyter notebook, it is best to install the Ipykernel when creating the virtual environment, the command is as follows:
create -n python2 python=2.7 ipykernel
Anaconda you need to add ipykernel after creating a python (2.7/3.6) virtual environment