Anaconda common commands

Time:2021-8-4

1. First install Anaconda on your system. You can open command line input

conda -V

Verify the installation and current version of CONDA.

2. CONDA is a common command.

1) See which packages are installed.

conda list 

2)   View which virtual environments currently exist

CONDA env list or CONDA Info - E or CONDA info -- envs

 

3) Check and update current CONDA

conda update conda 

 

3. Create a python virtual environment.

conda create -n your_env_name python=X.X

 

use  conda create -n your_env_name python=X.X(2.7, 3.6, etc.) command to create python with version x.x and name your_ env_ Name’s virtual environment. your_ env_ The name file can be found under the envs file in the anaconda installation directory.

Clone environment

conda create -n B --clone A

Create a clone of environment B from a

4. Use a virtual environment that activates (or switches between different Python versions).

 

Open command line input

python --version

 

You can check the current version of Python.

Use the following command to activate your virtual environment (i.e. change the version of Python).

Linux: conda activate your_env_name(virtual environment name)

conda activate your_env_name

 

Windows: activate your_env_name(virtual environment name)

activate your_env_name

 

This is reusepython --versionYou can check whether the current Python version is what you want.

5. Install additional packages in the virtual environment.

Use lifeMake CONDA install - n your_ env_ name[package] to install the package to your_ env_ In name

conda install -n your_env_name

 

6. Close the virtual environment (that is, exit from the current environment and return to the default Python version in the path environment).

Use the following command.

Linux: conda deactivate

conda deactivate

 

Windows: deactivate

deactivate

 

7. Delete the virtual environment.

Use commandconda remove -n your_env_name(virtual environment name) — all to delete.

conda remove -n your_env_name

 

8. Delete a package in the environment.

Use commandconda remove --name your_env_name package_name Just.

conda remove --name your_env_name package_name

 

9. Steps to uninstall Anaconda on Ubuntu:

(1) Delete the entire Anaconda Directory:

Since Anaconda’s installation files are contained in a directory, you can directly delete the directory. To the folder containing the entire Anaconda directory, delete the entire Anaconda Directory:

RM – RF Anaconda folder name

RM - RF Anaconda folder name

 

(2) It is recommended to clean up the anaconda path in. Bashrc:
1. Go to the root directory, open the terminal and enter:

sudo gedit ~/.bashrc

 

2. At the end of the. Bashrc file, comment out the previously added path with # sign (or delete it directly):
#export PATH=/home/luolingfeng/anaconda3/bin:$PATH
Save and close the file
3. Make it effective immediately and execute at the terminal:

source ~/.bashrc

 

4. Close the terminal and restart a new terminal. This step is very important, otherwise anaconda is bound to the original terminal