Last active
October 8, 2018 21:06
-
-
Save esc/4967965 to your computer and use it in GitHub Desktop.
Anconda activation and deactivation functions for ZSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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"