如何激活Anaconda环境 [英] How to activate an Anaconda environment

查看:276
本文介绍了如何激活Anaconda环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 8上,使用的是Anaconda 1.7.5 64bit.

我创建了一个新的Anaconda环境

conda create -p ./test python=2.7 pip

来自C:\Pr\TEMP\venv\.

这很好用(有一个带有新python发行版的文件夹).康达告诉我输入

activate C:\PR\TEMP\venv\test

激活环境,但是返回:

No environment named "C:\PR\temp\venv\test" exists in C:\PR\Anaconda\envs

如何激活环境?我在做什么错了?

解决方案

如果发生这种情况,则需要为您的环境设置PATH(以便从环境和Windows的Scripts \中获取正确的Python).

假设您使用以下方法创建了一个名为py33的环境:

conda create -n py33 python=3.3 anaconda

在默认情况下,文件夹是在Anaconda \ envs中创建的,因此您需要将PATH设置为:

set PATH=C:\Anaconda\envs\py33\Scripts;C:\Anaconda\envs\py33;%PATH%

现在它应该可以在命令窗口中工作:

activate py33

上面的行是Windows,等同于Mac和Linux教程中通常显示的代码:

$ source activate py33

更多信息: https://groups.google.com/a/continuum .io/forum/#!topic/anaconda/8T8i11gO39U

> anaconda`是否创建单独的是否为每个新环境都设置了PYTHONPATH变量?

I'm on Windows 8, using Anaconda 1.7.5 64bit.

I created a new Anaconda environment with

conda create -p ./test python=2.7 pip

from C:\Pr\TEMP\venv\.

This worked well (there is a folder with a new python distribution). conda tells me to type

activate C:\PR\TEMP\venv\test

to activate the environment, however this returns:

No environment named "C:\PR\temp\venv\test" exists in C:\PR\Anaconda\envs

How can I activate the environment? What am I doing wrong?

解决方案

If this happens you would need to set the PATH for your environment (so that it gets the right Python from the environment and Scripts\ on Windows).

Imagine you have created an environment called py33 by using:

conda create -n py33 python=3.3 anaconda

Here the folders are created by default in Anaconda\envs, so you need to set the PATH as:

set PATH=C:\Anaconda\envs\py33\Scripts;C:\Anaconda\envs\py33;%PATH%

Now it should work in the command window:

activate py33

The line above is the Windows equivalent to the code that normally appears in the tutorials for Mac and Linux:

$ source activate py33

More info: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/8T8i11gO39U

Does `anaconda` create a separate PYTHONPATH variable for each new environment?

这篇关于如何激活Anaconda环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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