pandas 在 Mac OS 10.8 上的 Anaconda 中更改默认 Python 环境(从 2.7 到 3.3)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21253989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing Default Python env.(from 2.7 to 3.3) in Anaconda on Mac OS 10.8
提问by Baktaawar
I have the Anaconda distribution installed for Mac. I have Mac OSX 10.8 (Mountain lion). The problem I don't often use Anaconda is because the default Python which it uses is 2.7 while I work on 3.3 or atleast prefer to work on that.
我为 Mac 安装了 Anaconda 发行版。我有 Mac OSX 10.8(山狮)。我不经常使用 Anaconda 的问题是因为它使用的默认 Python 是 2.7,而我使用 3.3 或至少更喜欢使用它。
I really like the Spyder IDE of Anaconda. Is there a way I can get the default environment on Anaconda changed to 3.3 instead of 2.7 so that Spyder and iPython all use 3.3 default?
我真的很喜欢 Anaconda 的 Spyder IDE。有什么办法可以将 Anaconda 上的默认环境更改为 3.3 而不是 2.7,以便 Spyder 和 iPython 都使用 3.3 默认值?
I see the following help from Anaconda site:
我从 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
My question is I have separately installed Python 3.3 and associated Scientific Python packages like Pandas, numpy, scipy, scikit-learn etc using Homebrew so that it doesn't conflict with my Mac OS default Python 2.7. So now if I run the above Conda commands in Mac Terminal will it interfere with other Python packages I have installed using Homebrew? or will it automatically install/upgrade the python and other packages in the Anaconda library without interfering with either the Homebrew installed Python or Mac OS default Python?
我的问题是我已经使用 Homebrew 单独安装了 Python 3.3 和相关的科学 Python 包,如 Pandas、numpy、scipy、scikit-learn 等,这样它就不会与我的 Mac OS 默认 Python 2.7 冲突。那么现在如果我在 Mac 终端中运行上述 Conda 命令,它会干扰我使用 Homebrew 安装的其他 Python 包吗?或者它会自动安装/升级 Anaconda 库中的 python 和其他软件包,而不会干扰 Homebrew 安装的 Python 或 Mac OS 默认的 Python?
Please advise.
请指教。
回答by asmeurer
No, the Homebrew and Anaconda Pythons will stay completely independent of one another. Just make sure you don't have PYTHONPATHset, which causes this to not be true.
不,Homebrew 和 Anaconda Pythons 将保持完全独立。只要确保你没有PYTHONPATH设置,这会导致这不是真的。
Also, you should know that Spyder is not available for Python 3 in Anaconda yet, because PySide has not yet been built for Python 3.
此外,您应该知道 Spyder 尚不可用于 Anaconda 中的 Python 3,因为 PySide 尚未针对 Python 3 构建。
回答by tim
I had installed Anaconda with python 2.7, but even after adding python3:
我已经用 python 2.7 安装了 Anaconda,但即使在添加 python3 之后:
conda create --name Py3 python=3
conda create --name Py3 python=3
spyder continued to call python2.7
spyder 继续调用python2.7
creating an environment with BOTH spyder and python=3 worked for me:
使用 spyder 和 python=3 创建环境对我有用:
conda create --name SpyPy3 python=3 spyder
conda create --name SpyPy3 python=3 spyder

