【发布时间】:2014-02-10 19:15:52
【问题描述】:
我为 Mac 安装了 Anaconda 发行版。我有 Mac OSX 10.8(山狮)。我不经常使用 Anaconda 的问题是因为它使用的默认 Python 是 2.7,而我使用 3.3 或至少更喜欢使用它。
我真的很喜欢 Anaconda 的 Spyder IDE。有没有办法让 Anaconda 上的默认环境更改为 3.3 而不是 2.7,以便 Spyder 和 iPython 都使用 3.3 默认值?
我从 Anaconda 网站看到以下帮助:
$ conda create -n py3k python=3 anaconda
Here python=3 and anaconda are package specifications, and it is the job of the SAT solver inside conda to find a consistent set of packages which satisfies these requirements. As the root environment uses Python 2, we had to specify the major version explicitly.
After adding the binary directory of the newly created environment to the PATH environment variable, which may be done using
$ source activate py3k
我的问题是我已经使用 Homebrew 单独安装了 Python 3.3 和相关的科学 Python 包,如 Pandas、numpy、scipy、scikit-learn 等,这样它就不会与我的 Mac OS 默认 Python 2.7 冲突。那么现在如果我在 Mac Terminal 中运行上述 Conda 命令,它会干扰我使用 Homebrew 安装的其他 Python 包吗?还是会自动安装/升级 Anaconda 库中的 python 和其他包,而不干扰 Homebrew 安装的 Python 或 Mac OS 默认的 Python?
请指教。
【问题讨论】:
-
只要确保
source activate你想要的python,你应该没问题。你总是可以通过which python(或which conda,which pip)在终端上判断哪个python是“活动的”。 -
@TomAugspurger 如何
source activate特定的python版本? -
conda 环境将有一个
bin文件夹,其中包含一个activate脚本。所以你想要source <ENV NAME>/bin/activate
标签: python-3.x pandas osx-mountain-lion anaconda