Conda is a popular package and environment management system for Python. It is widely used for creating, managing, and distributing software packages, as well as setting up and managing virtual environments.
This blog post provides a concise overview of the most commonly used conda commands, along with their usage and examples.
1. conda create
conda create creates a new conda environment. It takes a list of packages or specifications as arguments and installs them into the new environment.
conda create --name myenv python=3.8 pandas matplotlib
2. conda install
conda install installs one or more packages into the active environment. It supports installing packages from various channels and repositories.
conda install numpy scipy
3. conda update
conda update updates all the packages in the active environment to their latest versions.
conda update
4. conda remove
conda remove removes one or more packages from the active environment.
conda remove numpy
5. conda clean
conda clean removes unnecessary packages and files from the conda package cache.
conda clean --packages
6. conda list
conda list lists all the installed packages and their versions in the active environment.
conda list
7. conda info
conda info provides detailed information about the active environment, including the installed packages, dependencies, and settings.
conda info
8.conda env list
conda env list lists all the conda environments that have been created on your system. It provides information about the environment name, the Python version, and the packages installed in each environment.
conda env list
Output:
# conda environments:
#
base * /Users/username/anaconda3
myenv /Users/username/anaconda3/envs/myenv
In this output, base is the default conda environment that is created when you install conda. myenv is a custom environment that has been created by the user.
9. conda activate
conda activate activates a specific conda environment, making it the active environment.
conda activate myenv
10. conda deactivate
conda deactivate deactivates the active conda environment, returning to the default environment.
conda deactivate
11. conda search
conda search searches for packages in the conda channels and repositories. It can be used to find packages, check their versions, and display their descriptions.
conda search pandas
12. conda export
conda export exports the list of installed packages and their dependencies in the active environment to a text file.
conda export > environment.txt
13. conda env create --file
conda env create --file creates a new conda environment from a specified environment definition file. This file can contain the list of packages, dependencies, and settings for the environment.
conda env create --file environment.txt
14. conda config
conda config allows you to modify conda configuration settings. It can be used to set defaults, add channels, and configure settings for package installation and updates.
conda config --set always_copy yes
15. conda update --all
conda update --all updates all the packages in the active environment to their latest available versions.
conda update --all
These are just some of the most commonly used conda commands. For a complete list and detailed documentation, refer to the official conda documentation.
Comments
Post a Comment
Oof!