如何从 powershell 激活 conda 环境? [英] How to activate conda environment from powershell?

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

问题描述

版本Anaconda 4.8.3

我不能做什么:
我无法从 powershell 激活任何环境.conda 激活基础

What I cannot do:
I can't activate any environment from powershell. conda activate base

我能做什么:
conda 环境列表conda create -n xxx conda remove -n xxx

我尝试了很多解决方案,但结果都没有用:

I have tried many solutions, but they turn out to be useless:

  1. conda init powershell
    重启powershell
    conda 激活

  1. conda init powershell
    restart powershell
    conda activate

conda update -n base conda 并重做 1

conda update -n base conda and redo 1

conda install -n root -c pscondaenvs pscondaenvs
Set-ExecutionPolicy RemoteSigned
运行激活基地

运行conda activate的结果

推荐答案

您不需要管理员权限.

在 Windows 上安装 Anaconda 或 Miniconda 后,从开始"菜单打开 Anaconda Powershell Prompt.

Once you install Anaconda or Miniconda on Windows, open a Anaconda Powershell Prompt from Start Menu.

或者,如果你在那里没有看到它,那么假设你已经安装了路径 C:miniconda34.9.2 处的 miniconda3,执行:

Or, If you don't see it there, then assuming you have installed miniconda3 at path C:miniconda34.9.2, do:

powershell -ExecutionPolicy ByPass -NoExit -Command "& 'C:miniconda34.9.2shellcondabinconda-hook.ps1' ; conda activate 'C:miniconda34.9.2' "

现在试试:

conda init powershell

然后重新打开 powershell.

and reopen powershell.

补充说明:默认情况下,当我们打开终端时,conda 会自动激活.如果您不喜欢,请使用以下命令禁用自动激活:

Additional note: By default conda will autoactivate itself, when we open terminal. If you prefer not, then disable auto-activation with:

conda config --set auto_activate_base false

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

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