Skip to content

Instantly share code, notes, and snippets.

@mrdbourke
Last active June 27, 2021 13:07
Show Gist options
  • Save mrdbourke/0dd355a0f2213896da49aa6a5f926d62 to your computer and use it in GitHub Desktop.
Save mrdbourke/0dd355a0f2213896da49aa6a5f926d62 to your computer and use it in GitHub Desktop.
A list of helpful conda commands
Function Command
Get a list of all your environments conda env list
Get a list of all the packages installed in your current active environment conda list
Create an environment called [ENV_NAME] conda create --name [ENV_NAME]
Create an environment called [ENV_NAME] and install pandas and numpy conda create --name [ENV_NAME] pandas numpy
Activate an environment called [ENV_NAME] conda activate [ENV_NAME]
Create an environment folder called env in the current working directory (e.g. /Users/Daniel/project_1/) and install pandas and numpy conda create --prefix ./env pandas numpy
Activate an environment stored in a folder called env which is located within /Users/Daniel/project_1/ conda activate /Users/daniel/project_1/env
Deactivate an environment conda deactivate
Export your current active environment to a YAML file called environment (see why below) conda env export > environment.yaml
Export an environment stored at /Users/Daniel/project_1/env as a YAML file called environment (see why below) conda env export --prefix /Users/Daniel/project_1/env > environment.yaml
Create an environment from a YAML file called environment (see why below) conda env create --file environment.yaml
Install a new package [PACKAGE_NAME] in a target environment (while the target environment is active) conda install [PACKAGE_NAME]
Delete an environment called [ENV_NAME] conda env remove --name [ENV_NAME]
Delete an environment stored at /Users/Daniel/project_1/env conda remove --prefix /Users/Daniel/project_1/env --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment