Open sidebar
Briefly teach me how to use Anaconda commands
Anaconda is a popular Python data science and machine learning platform. It provides many tools and libraries that make Python data-science workflows easier and more efficient. Here are some commonly used Anaconda commands:
- Create an environment
Create a new environment named myenv containing Python 3.8:
conda create --name myenv python=3.8
- Activate an environment
Activate the environment named myenv:
conda activate myenv
- View installed environments
List all installed environments:
conda env list
- Install a package
Install a package named numpy in the currently active environment:
conda install numpy
Install a specified package version:
conda install numpy=1.18
- Update a package
Update the package named numpy:
conda update numpy
- Search for a package
Search for the package named numpy:
conda search numpy
- Export an environment
Export all packages and their versions from the current environment to environment.yml:
conda env export > environment.yml
- Import an environment from a file
Create a new environment named myenv from environment.yml:
conda env create --name myenv --file environment.yml
- Deactivate an environment
Deactivate the currently active environment:
conda deactivate
These are commonly used Anaconda commands. You can use them to manage Python environments and packages. For more Anaconda commands, refer to the Anaconda documentation.
How to delete an environment
To delete an environment named myenv, use the following commands:
- Confirm the currently active environment:
conda info --envs
This lists all installed environments and marks the currently active one with *.
- Deactivate the current environment:
If the current environment is myenv, deactivate it with:
conda deactivate
- Delete the environment:
Delete the environment named myenv with:
conda remove --name myenv --all
This deletes all packages and dependencies installed in myenv and removes the environment from Anaconda.
Note that deleting an environment is irreversible, so use this command with care.
ChatGPT Feb 13 Version. Free Research Preview. Our goal is to make AI systems more natural and safe to interact with. Your feedback will help us improve.