I installed anaconda3 using the standard settings and mainly use tcsh. If terminal opens in tcsh and then I type "conda" it works. If I type "python" it shows
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
But, if I type "bash" and then "tcsh" and then "python" it shows this:
Python 3.6.2 |Anaconda, Inc.| (default, Sep 21 2017, 18:29:43)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
For reference, my .tcshrc file contains this:
set path = ( $path anaconda3/bin . /opt/local/bin /opt/local/ncbi/blast )
alias python2 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3 '/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'
.bashrc contains:
export PATH=~/anaconda3/bin:$PATH
.bash_profile contains:
source ~/.bashrc
PATH=$PATH:$HOME/anaconda3/bin
export PATH="/anaconda3/bin:$PATH"
I'm new to Unix and Python but need to set up anaconda in both bash and tcsh for a class. Any ideas?
update:
"which python" yields "/usr/bin/python" when I start up terminal in tcsh
If I switch to bash, "which python" yields "/anaconda3/bin/python"
"echo $PATH" in tcsh yields "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:anaconda3/bin:.:/opt/local/bin:/opt/local/ncbi/blast"
"echo $PATH" in bash yields "/anaconda/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:anaconda3/bin:.:/opt/local/bin:/opt/local/ncbi/blast"
First, please take a look at this question and its answers to understand how the PATH environment variable works: https://unix.stackexchange.com/questions/77898/how-does-the-path-enviroment-variable-work-in-linux.
Your issue is that in your ~/.tcshrc you are not adding the Anaconda directory to the front your PATH, so tcsh finds the system installation first and uses that. To fix this you can modify the first line of that file to read:
setenv PATH ~/anaconda3/bin:$PATH:.:/opt/local/bin:/opt/local/ncbi/blast
In tcsh, setenv serves a similar purpose to export in bash, so using just set would not reliably change your PATH.
As a side note, you appear to be making the same modification to your bash PATH over and over... you could clean that up a bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With