Python 同时安装 Anacondas 2.7 和 3.5 可以吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37442494/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:24:45  来源:igfitidea点击:

Is it ok having both Anacondas 2.7 and 3.5 installed in the same time?

pythonpython-3.xpython-2.7anacondavirtualenv

提问by GileBrt

I am using currently Anaconda with Python 2.7, but I will need to use Python 3.5. Is it ok to have them installed both in the same time? Should I expect some problems?
I am on a 64-bit Win8.

我目前使用 Anaconda 和 Python 2.7,但我需要使用 Python 3.5。可以同时安装它们吗?我应该期待一些问题吗?
我使用的是 64 位 Win8。

采纳答案by Padraic

My understanding is you don't need to install Anaconda again to start using a different version of python. Instead, conda has the ability to separately manage python 2 and 3 environments.

我的理解是您无需再次安装 Anaconda 即可开始使用不同版本的 Python。相反,conda能够分别管理 python 2 和 3 环境

回答by Grr

I use both depending on who in my department I am helping (Some people prefer 2.7, others 3.5). Anyway, I use Anacondaand my default installation is 3.5. I use environments for other versions of python, packages, etc.. So for example, when I wanted to start using python 2.7 I ran:

我根据我要帮助的部门中的谁来使用这两种方法(有些人喜欢 2.7,有些人喜欢 3.5)。无论如何,我使用Anaconda,我的默认安装是 3.5。我使用其他版本的 python、包等的环境。例如,当我想开始使用 python 2.7 时,我运行:

 conda create -n Python27 python=2.7

This creates a new environment named Python27 and installs Python version 2.7. You can add arguments to that line for installing other packages by default or just start from scratch. The environment will automatically activate, to deactivate simply type deactivate(windows) or source deactivate(linux, osx) in the command line. To activate in the future type activate Python27(windows) or source activate Python27(linux, osx). I would recommend reading the documentation for Managing Environmentsin Anaconda, if you choose to take that route.

这将创建一个名为 Python27 的新环境并安装 Python 2.7 版。您可以向该行添加参数以默认安装其他软件包或从头开始。环境将自动激活,只需在命令行中键入deactivate(windows) 或source deactivate(linux, osx)即可停用。将来激活类型activate Python27(windows) 或source activate Python27(linux, osx)。如果您选择采用该方法,我建议您阅读在 Anaconda 中管理环境的文档。

Update

更新

As of condaversion 4.6 you can now use conda activateand conda deactivate. The use of sourceis now deprecated and will eventually be removed.

conda4.6 版开始,您现在可以使用conda activateconda deactivate。的使用source现已弃用,最终将被删除。

回答by Axis

Yes you can.

是的你可以。

You don't have to download both Anaconda.

您不必同时下载 Anaconda。

Only you need to download one of the version of Anaconda and need activate other version of Anaconda python.

只需要下载一个版本的Anaconda并激活其他版本的Anaconda python。

If you have Python 3, you can set up a Python 2 kernel like this;

如果你有 Python 3,你可以像这样设置 Python 2 内核;

python2 -m pip install ipykernel

python2 -m ipykernel install --user

If you have Python 2,

如果你有 Python 2,

python3 -m pip install ipykernel

python3 -m ipykernel install --user

Then you will be able to see both version of Python!

然后你将能够看到两个版本的 Python!

If you are using Anaconda Spyder then you should swap version here:

如果您使用的是 Anaconda Spyder,那么您应该在此处交换版本:

enter image description here

在此处输入图片说明

If you are using Jupiter then check here:

如果您使用的是 Jupiter,请在此处查看:

enter image description here

在此处输入图片说明

Note: If your Jupiter or Anaconda already open after installation you need to restart again. Then you will be able to see.

注意:如果您的 Jupiter 或 Anaconda 在安装后已经打开,您需要重新启动。然后你就可以看到了。

回答by Allan Nelson

I have python 2.7.13 and 3.6.2 both installed. Install Anaconda for python 3 first and then you can use conda syntax to get 2.7. My install used: conda create -n py27 python=2.7.13 anaconda

我已经安装了 python 2.7.13 和 3.6.2。首先为 python 3 安装 Anaconda,然后你可以使用 conda 语法来获得 2.7。我的安装使用: conda create -n py27 python=2.7.13 anaconda

回答by Will Nilges

Yes, It should be alright to have both versions installed. It's actually pretty much expected nowadays. A lot of stuff is written in 2.7, but 3.5 is becoming the norm. I would recommend updating all your python to 3.5 ASAP, though.

是的,安装两个版本应该没问题。如今,这实际上是非常值得期待的。很多东西是用 2.7 编写的,但 3.5 正在成为常态。不过,我建议您尽快将所有 python 更新到 3.5。

回答by Akash Sonthalia

Anaconda is made for the purpose you are asking. It is also an environment manager. It separates out environments. It was made because stable and legacy packages were not supported with newer/unstable versions of host languages; therefore a software was required that could separate and manage these versions on the same machine without the need to reinstall or uninstall individual host programming languages/environments.

Anaconda 是为您所要求的目的而制作的。它也是一个环境管理器。它分离出环境。这是因为较新/不稳定版本的宿主语言不支持稳定和旧版软件包;因此,需要一种软件可以在同一台机器上分离和管理这些版本,而无需重新安装或卸载单个主机编程语言/环境。

You can find creation/deletion of environments in the Anaconda documentation.

您可以在 Anaconda 文档中找到环境的创建/删除。

Hope this helped.

希望这有帮助。