简体   繁体   English

康达,我怎样才能激活一个特定的环境

[英]Conda, how can I activate an specefic env

I'm trying to use conda activate <env> in my vscode's terminal.我正在尝试在我的 vscode 终端中使用conda activate <env> But nothing seems to work.但似乎没有任何效果。

在此处输入图像描述

I have two environments, SharkiPyTorch and base , only the first one has Opencv installed.我有两个环境, SharkiPyTorchbase ,只有第一个安装了Opencv Despite of that I didn't get any response from using conda activate base .尽管如此,我没有从使用conda activate base得到任何回应。 I tried to execute my example.py file, using both environments but I just got an error saying that the module OpenCV is missing.我尝试使用这两种环境来执行我的example.py文件,但我收到一条错误消息,提示缺少模块 OpenCV。

I used the conda list for both environments and I checked that I have Opencv in one of them.我对这两种环境都使用了conda list ,并检查了其中一个环境中是否有 Opencv。

I don't know why I can't select my environments.我不知道为什么我的环境不能 select。

在此处输入图像描述

VScode is using Python's conda path. VScode 使用 Python 的 conda 路径。

I just noticed that doing code.我只是注意到做code. in conda's terminal in the folder path, I can load my proyect from my environment and it works, nevertheless I'd like to be able to use commands for my environments from my Vscode's terminal.在文件夹路径中的 conda 终端中,我可以从我的环境加载我的项目并且它可以工作,但是我希望能够从我的 Vscode 终端为我的环境使用命令。

The VSCode terminal "powershell" does not automatically activate the conda environment by default. VSCode 终端“powershell”默认不会自动激活 conda 环境。 I use the command " conda init powershell " to make it automatically activate the conda environment: (please open a new terminal)我使用命令“ conda init powershell ”使其自动激活conda环境:(请打开一个新终端)

在此处输入图像描述

Then, we can use the command " conda activate XXX " to activate other conda environments:然后,我们可以使用命令“ conda activate XXX ”来激活其他 conda 环境:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM