当然,如果您想单独使用 Anaconda 发行版,您可以设置一个别名来运行该版本,并将常用的 python 保留为默认值。
在您的.bash_profile 文件中,Anaconda 安装程序可能会放入以下行:
export PATH="/path/to/your/anaconda/bin:$PATH"
注释掉这个,并添加一个别名;例如
alias pyconda='/path/to/your/anaconda/bin/python'
然后,您可以通过在新终端中运行 pyconda 来运行您的 Anaconda python 发行版。
更新
实际上,当您想使用 anaconda 安装中的所有内容而不是仅使用 python 时,将其放入您的路径可能会更好(这就是您的 ipython 最初损坏的原因)。
为此,请设置一个别名,如下所示:
alias anacondainit='export PATH="/path/to/your/anaconda/bin:$PATH"'
然后,您的 anaconda 安装将成为该终端会话中所有内容的默认设置。
例如,打开一个新终端后,尝试以下操作:
amorgan$ python # on a freshly opened terminal, this will load your default distro
Python 2.7.2 |EPD 7.2-1 (32-bit)| (default, Sep 7 2011, 09:16:50)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "packages", "demo" or "enthought" for more information.
>>> exit()
amorgan$ anacondainit #initialize anaconda
amorgan$ python #now when we run python, it will load the anaconda distro
Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
要再次使用您的其他发行版,只需加载一个新终端,从而将 anaconda 排除在您的路径之外。