anaconda virtual environment management for mac

1. Create a virtual environment

conda create -n 环境名(自命名) python=version(指定版本)

2. View the virtual environment

conda env list

* Indicates the current running environment

3. Activate the virtual environment

conda activate tf2

problem appear:

The shell does not know what to translate, but here it prompts See 'conda init --help' for more information and options, so I typed

conda init --help

The result is

In other words, the usage of 'conda init', parameters and so on, good English can be read directly

The meaning I see is roughly that this sentence is used to initialize the shell interaction. If there is no parameter, the windows system default is to initialize bash, unix is ​​all shell

Key parts of ... This section has 'conda deactivate' and 'conda activate', which means that these two commands are especially shell-level, shell-level commands.

This command ... The information in this paragraph gives two flags

--dry-run means you can check which specific files or locations will be affected before

For changes to take effect, close. . . It means that if you want to change, close and reopen a shell, so here, I feel that the shell is roughly like a terminal and can interact with the computer

--verbose is to see how specific changes will occur

The two flags are probably, the first one tells you which files may be changed, and the second is to see what changes have occurred in each location.

So in the end, I just typed

conda init

After closing the terminal and restarting, you enter the (base) environment.

Enter conda env list, then enter conda activate tf2, it starts successfully

4. Exit the virtual environment

conda deactivate

Will exit from tf2's virtual environment to base

Enter conda deactivate again to exit from anaconda and return to the original environment of the machine

 

Description:

1. This is operated in the terminal. If you are in the anaconda navigator, you can directly click the button in the environment, but every time you open the anaconda, it will take a lot of memory.

2. Conda init only needs to be executed once after creating a new virtual environment, and the virtual environment on the computer will be initialized. After that, I want to start tf2, and directly conda activate tf2.

Published 16 original articles · praised 0 · visits 448

Guess you like

Origin blog.csdn.net/weixin_43951831/article/details/105134289