Jupyter-notebook environment switching and default file storage location settings

1. I installed jupyter notebook using Anaconda, so download anaconda first. Below is the download address.

Go to download anaconda and the
detailed download process will not be repeated.

2. After opening anaconda, you will find that there will be a default jupyter notebook available for download, download it.

3. Then create a dedicated virtual environment. As shown in the figure below, click Create in Environments and enter the name.

Insert picture description here

4. To switch the environment, two packages are needed, namely nb_conda and ipykernel.

There are two installation methods:

  1. Anaconda internal download. Just search and download in the search box as shown below. The previous installed is replaced by not installed.
    Insert picture description here
  2. Code installation.
    Open the anaconda prompt, switch the environment activate name, name is the environment name set by yourself.
conda install nb_conda
conda install -n python_env ipykernel

Insert picture description here

5. Most people definitely don't want to save files to C drive (except for C drive enough space, haha), they need to switch the default storage location

Open the anaconda prompt, switch to the virtual environment set by yourself (you don't have to create the default root), and enter the following code.

jupyter-notebook --generate-config

You can see the default storage location. According to this location, find the corresponding py file in your computer, open it (as shown in the first picture below), remove the comment in the second picture file, and create a new one The folder where the file is stored, write this location, and the modified effect is as shown in the second figure. Save and close. The modification is now complete.
Note: The folder used to store files must be created in advance, otherwise an error will be reported.
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qwerty1372431588/article/details/107595376