Here’s a cheat sheet for Anaconda, a popular distribution of Python for data science and machine learning:
Installation
- Download Anaconda from official website.
- Follow installation instructions for your operating system.
Create and Manage Environments
Create a new environment:
conda create --name myenv
Create an environment with a specific Python version:
conda create --name myenv python=3.8
Activate an environment:
conda activate myenv
Deactivate the current environment:
conda deactivate
Remove an environment:
conda remove --name myenv --all
Managing Packages
Install a package:
conda install package_name
Install specific version of a package:
conda install package_name=1.2.3
Update a package:
conda update package_name
Remove a package:
conda remove package_name
Listing Environments and Packages
List all environments:
conda env list
List all packages in the active environment:
conda list
Jupyter Notebooks
Install Jupyter:
conda install jupyter
Launch Jupyter Notebook:
jupyter notebook
Here is a dedicated Jupyter Markdown Cheat Sheet.
Managing Channels
Add a channel:
conda config --add channels channel_name
Remove a channel:
conda config --remove channels channel_name
Managing Python Versions
List available Python versions:
conda search "^python$"
Install a specific Python version:
conda install python=3.8
Exporting and Creating Environment Files
Export environment to a file:
conda env export > environment.yml
Create an environment from a file:
conda env create -f environment.yml
Miscellaneous Commands
Clean unused packages and caches:
conda clean --all
Check for updates:
conda update --all
Search for packages:
conda search package_name
This cheat sheet covers essential commands for managing environments and packages with Anaconda.