Skip to content

Instantly share code, notes, and snippets.

@esc
Last active October 8, 2018 21:06
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save esc/4967965 to your computer and use it in GitHub Desktop.
Save esc/4967965 to your computer and use it in GitHub Desktop.
Anconda activation and deactivation functions for ZSH
# Functions to activate/deactivate Continuum Analytics Anaconda Python distribution
# by manipulating the $PATH.
export ANACONDA_PATH="$HOME/anaconda/bin"
function have_anaconda(){
[[ -n $path[(r)$ANACONDA_PATH] ]]
}
function anaconda_on(){
if have_anaconda ; then
print "Anaconda already activated"
else
export PATH=$ANACONDA_PATH:$PATH
fi
}
function anaconda_off(){
if ! have_anaconda ; then
print "Anaconda not found on PATH"
else
path[$path[(i)$ANACONDA_PATH]]=()
fi
}
@hagai-lvi
Copy link

Thanks for the great script!
if someone is having trouble in ubuntu, anaconda 2.7 is installed in $HOME/anaconda2/.
So in ubuntu you need export ANACONDA_PATH="$HOME/anaconda2/bin"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment