Install Jupter Notebook in Anaconda virtual environment

The installation process of Anaconda will not be repeated. Installing Anaconda will install Jupyter Notebook by the way. This article mainly records how to use Anaconda to create a virtual environment and how to use the created environment in jupyter Notebook.

  1. Create a virtual environment
conda create -n 虚拟环境名 python=版本
  1. Activate the virtual environment
activate 虚拟环境名
  1. Install ipykernel in the virtual environment (in the corresponding virtual environment)
pip install ipykernel
  1. Use ipykernel to generate the kernel of the virtual environment (in the corresponding virtual environment)
python -m ipykernel install --user --name 虚拟环境名
  1. Exit the virtual environment and reopen Jupyter Notebook in the base environment, and you will find that there is already a virtual environment kernel to choose from
    • Exit the virtual environment
    conda deactivate
    
    • Open Jupter Notebook
    jupyter notebook
    

The jupter notebook command can be used directly in the base environment or in a virtual environment. If you use it in a virtual environment, you need to exit the virtual environment and re-enter after the installation is complete.

Guess you like

Origin blog.csdn.net/qq_44924544/article/details/108798152