
Managing Environments with Miniconda
The previous article explains how to properly install and configure Miniconda. This article will explain how to manage your environments.
Creating a Virtual Environment
conda create --name <myenv> python=<3.7> -yThis command will create a virtual environment with the following properties:
- -name myenv You can choose any name you want here
- python=3.7 you can set the version to be whatever you want such as 2.7 (if you don't specify a version it will choose the latest)
- -y this just preemptively answers yes to creating the environment
Activating a Virtual Environment
conda activate <myenv>Deactivating a Virtual Environment
conda deactivate <myenv>Listing Available Environments
conda env listRemoving an Environment
conda remove --name <myenv> --allCloning an Environment
conda create --name <myclone> --clone <myenv>Removing PS1 Prompt
conda config --set changeps1 falseTo re-enable:
conda config --set changeps1 trueSearching for packages
conda search <package-name>Sharing an environment
- First export the environment
conda env export > environment.yml- Now install in another Anaconda Environment Manager
conda env create -f environment.ymlInstalling Packages & Pinning Versions
- With conda (=)
conda install <package>=<version-number>- With pip (==)
pip install <package>==<version-number>