Table of Contents
Install Anaconda
Note: It’s not good practice to share anaconda environments with other users. Make sure to make a backup of your startup file and that you launch a new terminal after the installation. Example below is for bash.
Code Block |
---|
cp -p ~/.profile ~/.profile.orig |
...
You can find the latest version here: https://www.anaconda.com/distribution/#download-section
Note that the graphical installer is the easiest to use although a command-line instruction is also available here https://docs.anaconda.com/free/anaconda/install/mac-os/
Make sure you allow Anaconda to modify your bash profile otherwise it will not work
...
Code Block |
---|
conda --version |
To update, make sure you are in your home directory
Code Block |
---|
cd ~; conda update -n base -c defaults conda |
Getting multiple versions of python
List the versions of python you available.
...
or
Code Block |
---|
conda env list |
Switching between environments
To switch between environments, run the following
Code Block |
---|
#Assuming py27 is the environment name, run: conda activate /Users/john/anaconda3/envs/py27 #To switch back to the original environment, run: conda deactivate |
Activating and Deactivating Anaconda
Instead of uninstalling anaconda, you can activate and deactivate Anaconda when needed.
Permanently
The following command will stop Anaconda from launching the base environment upon launching terminal and when opening new terminal windows.
...
Temporarily
The following commands will temporarily activate and deactivate Anaconda in a single terminal window. Opening a new terminal window will open in anaconda's base environment.
NOTE: The commands below only works on Conda 4.6 and newer.
...
Code Block |
---|
source deactivate |
Deleting environments
https://iq.opengenus.org/delete-conda-environment/
Exporting and Importing Environments
Exporting environments
Code Block |
---|
conda env export > environment.yml |
Importing environments
Code Block |
---|
conda env create -f environment.yml |
...
reference https://docs.anaconda.com/anaconda/user-guide/tasks/switch-environment/