如何使用两个Anaconda版本(2.7和3.5)? [英] How can I use both Anaconda versions (2.7 & 3.5)?

查看:143
本文介绍了如何使用两个Anaconda版本(2.7和3.5)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 10计算机中使用Anaconda 3.5 发行版.由于要使用的库中的依赖项,我还必须安装2.7版本.

I was using the Anaconda 3.5 distro in a Windows 10 machine. Due to dependencies in libraries that I want to work with, I had to have the 2.7 version installed as well.

好消息是,我现在需要的库现在可以与2.7版本一起正常使用,并且Visual Studio 2015自动检测到我的新Python环境.

The good news is that the libraries I needed can now work with the 2.7 version smoothly and Visual Studio 2015 automagically detected my new Python environment.

使用命令行时出现问题.发出命令后

The problem comes when using the command line. Upon issuing the command

conda info --envs

我知道

root                  *  C:\Users\norah\Anaconda2

即一个单一的环境(据我到目前为止的理解和搜索,根据,我应该参见列出的两个环境).这意味着我不能使用conda为我的Python3.5安装获取新软件包,至少不能像以前那样在命令行中获取,因为conda仅引用Python2.7. GUI版本的Anaconda导航器也是如此(我不太喜欢GUI版本,但我尝试了).

i.e. a single environment (to my understanding and search so far, according to this I should see two envs listed). This means I can't use conda to acquire new packages for my Python3.5 installation, at least not at the command line as I used to since conda only refers to Python2.7. The same goes for the GUI version, Anaconda navigator (I'm not very fond of the GUI version but I tried it out).

$python

总是启动python2.7并在命令行中发出$python3$python3.5似乎不起作用(也不会将python3的路径添加到系统中,因为实际的可执行文件与python2具有相同的名称,即python.exe)

always fires up python2.7 and issuing $python3 or $python3.5 in the command line doesn't seem to work (nor would adding the path of python3 to the system since the actual executable has the same name as python2 i.e. python.exe)

我的系统是否已被Python2.7接管? 这里有人可以顺利使用它们吗?如果可以,请详细说明如何操作?安装两个版本的Anaconda是否不行"?

Is my system taken over by Python2.7? Is anyone here using them both smoothly and if so could you please elaborate on how to do that? Was it a "no no" move to install both versions of Anaconda?

推荐答案

您可以使用Anaconda 2.7制作Python 3.5环境:

You can make Python 3.5 environment with your Anaconda 2.7:

conda create -n py35 python=3.5

现在,将其激活:

activate py35

最后,您可以安装所需的软件包:

Finally you can install the desired packages:

conda install numpy

或者整个蟒蛇:

conda install anaconda

这种方法的优点是您还可以创建Python 3.4或3.6环境.此外,您可以创建具有不同库组合和版本的环境.

The advantage of this approach is that you can also create Python 3.4 or 3.6 environments. Furthermore, you can create environments with different combinations and versions of libraries.

实际上,为每个较大的项目创建一个新的环境是很有意义的.

Actually, it makes sense to create a new environment for each larger project.

这篇关于如何使用两个Anaconda版本(2.7和3.5)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆