【发布时间】:2018-03-20 06:50:17
【问题描述】:
我使用标准设置安装了anaconda3,主要使用tcsh。 如果终端在 tcsh 中打开,然后我输入“conda”,它就可以工作。 如果我输入“python”它会显示
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.
但是,如果我输入“bash”,然后输入“tcsh”,然后输入“python”,它会显示:
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.
作为参考,我的 .tcshrc 文件包含以下内容:
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 包含:
export PATH=~/anaconda3/bin:$PATH
.bash_profile 包含:
source ~/.bashrc
PATH=$PATH:$HOME/anaconda3/bin
export PATH="/anaconda3/bin:$PATH"
我是 Unix 和 Python 的新手,但需要在 bash 和 tcsh 中为一个类设置 anaconda。有什么想法吗?
更新:
当我在 tcsh 中启动终端时,“which python”会产生“/usr/bin/python”
如果我切换到 bash,“which python”会产生“/anaconda3/bin/python”
"echo $PATH" 在 tcsh 中产生 "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:anaconda3/bin:.:/opt/local/bin:/opt /local/ncbi/blast"
"echo $PATH" 在 bash 产量 "/anaconda/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:anaconda3/bin:.:/opt/local/bin:/opt/本地/ncbi/blast”
【问题讨论】:
-
请为每种情况输入
which python。这将显示 shell 将使用的python二进制文件的路径。对于每种情况,键入echo $PATH也可能很有启发性。似乎在您的 bash 启动脚本中,您正在对PATH进行很多 修改。 -
在 bash 中键入:echo $PATH 和哪个 python 来查看你的 PATH 并查看你正在使用什么 python-interpreter。
-
@SethMMorton 以上更新
-
@AAA 我敢打赌,在切换到 bash 之前, 中的 PATH 不是这样的。
-
@SethMMorton 是的,你是对的。改变了^
标签: python bash python-3.x csh tcsh