Created
February 12, 2015 11:40
-
-
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.
This file contains 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
## 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