Skip to content

Instantly share code, notes, and snippets.

@nudomarinero
Created February 12, 2015 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nudomarinero/8c196319e151fa15bf90 to your computer and use it in GitHub Desktop.
Save nudomarinero/8c196319e151fa15bf90 to your computer and use it in GitHub Desktop.
Functions in bash to activate or deactivate Anaconda. They can be added to the bashrc file and allow to go back quickly to the system Python if needed.
## Anaconda
# Based on http://stackoverflow.com/questions/370047/what-is-the-most-elegant-way-to-remove-a-path-from-the-path-variable-in-bash#370255
anaconda () {
path=$(IFS=':';t=($PATH);n=${#t[*]};a=();for ((i=0;i<n;i++)); do p="${t[i]%%*anaconda*}"; [ "${p}" ] && a[i]="${p}"; done;echo "${a[*]}");
export PATH=~/anaconda/bin:$path
}
noanaconda () {
path=$(IFS=':';t=($PATH);n=${#t[*]};a=();for ((i=0;i<n;i++)); do p="${t[i]%%*anaconda*}"; [ "${p}" ] && a[i]="${p}"; done;echo "${a[*]}");
export PATH=$path
}
anaconda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment