references
Reference 1: Jupyter notebook switch Python environment
Source of problem
It is often necessary to use anaconda's virtual environment, and jupyter is a good way to switch. Other netizens have summed up the solution to the nb_conda method, but a serious error occurred during the practice. For example, jupyter crashes and so on.
- Install jupyter in other virtual environments, open the prompt IOloop
- Installed multiple nbextensions, prompting repeated yaml file error
- Jupyter running prompt 404 etc.
solve
Method: still use the nb_conda plug-in solution, but by trying a variety of methods, the optimal process is determined
1. Install anaconda
slightly
2. Base environment finishing
- Install jupyter notebook
- When installing
before jupyter_contrib_nbextensions , after running jupyter contrib nbextensions install --user, running jupyter prompts repeated yaml file errors. Trial operation is possible, if an error is reported, jupyter contrib nbextensions uninstall --user - Install nb_conda
conda install nb_conda
3. Manage virtual environments
The overall idea is: install ipykernel for each virtual environment in jupyter under the base environment.
ps: I installed it in the virtual environment before, but it failed.
- Create more virtual environments (only choose python)
- Open jupyter notebook in base environment
- Go to the conda interface in the jupyter notebook (as shown in the figure below) and
click add.
Click the created virtual environment ----> search for ipyker in the search bar ----> install ipykernel for the virtual environment
result
Finally solved. A lot of time was wasted.