问题描述
我正在运行Mac 10.9 Mavericks,并安装了Anaconda.但是,尽管如此,当我通过终端访问python时,我仍然获得默认的Apple版本:
I am running Mac 10.9 Mavericks and have installed Anaconda. However, despite that, when I access python via terminal, I still get the default Apple version:
Python 2.7.5 (default, Sep 2 2013, 05:24:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
我的.bash_profile是这样的:
My .bash_profile is this:
export PATH="$HOME/anaconda/bin:$PATH"
MONGO_PATH=/usr/local/mongodb/bin
SQL_PATH=/usr/local/mysql
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH"
我可以使用Anaconda版本的Python做任何事情吗?此刻不知所措.
Is there anything I can do to use the Anaconda version of Python? At a loss at the moment.
谢谢
推荐答案
第一个匹配的可执行文件是运行的可执行文件.据我所知,您正在以下列方式串联PATH变量:
The first matching executable is the one that is run. From what I can gather you are concatenating your PATH variable in such a way that:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
之前出现:
$HOME/anaconda/bin
因此确保,anaconda目录是第一个目录,这意味着它将具有优先级:
So make sure that the anaconda directory is the first one, meaning that it will have precedence:
export PATH="$HOME/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH"
这篇关于尽管安装了Anaconda,Mac仍使用默认Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!