如何让conda命令在Vscode的集成终端和普通终端中匹配行为? [英] How to have conda commands match behaviour in Vscode's integrated terminal and normal terminal?

查看:442
本文介绍了如何让conda命令在Vscode的集成终端和普通终端中匹配行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被推迟了,因为conda info --envs不会显示与终端相同的内容.终端:

I was put off because conda info --envs does NOT display the same thing that my terminal does. Terminal:

(automl) brandBrandoParetoopareto~/anaconda3/envs $ conda info --envs
# conda environments:
#
base                     /Users/brandBrandoParetoopareto/anaconda3
automl                *  /Users/brandBrandoParetoopareto/anaconda3/envs/automl
coqgym                   /Users/brandBrandoParetoopareto/anaconda3/envs/coqgym

vscode集成终端输出:

vscode integrated terminal outpute:

(automl) brandBrandoParetoopareto~/ultimate-utils $ conda info --envs
# conda environments:
#
                         /Users/brandBrandoParetoopareto/anaconda3
base                  *  /Users/brandBrandoParetoopareto/anaconda3/envs/automl
                         /Users/brandBrandoParetoopareto/anaconda3/envs/coqgym

这真的很奇怪,因为它似乎使用的是正确的env,我不知道这是因为在调试器窗口中,它不显示(automl),而是显示(base),但指向正确的env(实际上,上一个命令输出,如果您仔细阅读该命令,则表示它正在使用(automl),但实际上它正在使用base,但它似乎指向正确的环境!?!?但名称错误.

it is really strange because it seems to be using the right env which I would have not know because in the debugger window it does not show (automl) but says (base) but points to the right env (In fact the previous command output if you read it carefully says it's using (automl) but then it's actually using base BUT it seems to be pointing to the right environment!?!? But wrong names).

这似乎是一种奇怪的行为,有人知道如何解决此问题,或者是否引起其他意外问题?

This seems like weird behavior does anyone know how to fix this or if it's causing other unexpected issues?

也许这应该发布在vscode问题中,但是我不知道是哪一个,因为有一个 vscode 和一个 vscode-python 一个.

Perhaps this should be posted in vscode issues but I couldn't figure out which one since there is a vscode and a vscode-python one too.

相关问题:

  • 我最初看到此问题 Conda和Visual Studio代码调试,因为我考虑到由于它指向的是基准(或至少显示了错误的名称),因此无法识别或知道我的conda路径在哪里,因此该问题似乎有用,但最终未能解决命名问题.
  • 最初,我还以为它可能与30天前发生的一个conda init问题有关,但并没有与
  • I initially saw this issue Conda and Visual Studio Code debugging because I thought since it was pointing at base (or at least displaying wrong names) that it didn't recognize or know where my conda path was so that question seemed useful but ended up not fixing the naming issues.
  • Initially I also thought that it might have been related to a conda init issue I had exactly 30 days ago but it wasn't related unfortuantely Why is conda init updating my .bash_profile incorrectly?

每个评论请求都要检查inheritEnv(要进入设置,然后在搜索栏中键入inheritEnv):

Per comment request to check inheritEnv (to get to it go to settings then in search bar type inheritEnv):

该框未选中,我认为这意味着"terminal.integrated.inheritEnv"设置为false

the box is unchecked which I assume means "terminal.integrated.inheritEnv" is set to false

我现在看到的奇怪的是:

The weird thing I am seeing now is that:

  1. 选择环境的底部conda right选项,我要使用的环境未出现.即使我将路径粘贴到它的选项上,它也不起作用.
  2. 当我启动一个新终端时,尽管我的zsh已经开始使用正确的环境,但它还是决定自行激活该终端.这是为什么?但是,即使我执行zsh来启动新提示时,左下角似乎也没有指向右侧conda env.
  1. the bottom conda right option to select environments, the environment I want to use does NOT appear. Even when I paste the path to it's option it does not work.
  2. When I start a new terminal, somehow it decides to activate base by it's own eventhough my zsh already starts using the correct environment. Why is that? But even when I do zsh to start a new prompt, the bottom left does not seem to point to the right conda env.

推荐答案

我的建议是简单地将VS Code设置为使用您通常使用的shell: 如何在可视化环境中更改集成终端工作室代码或VSCode

My recommendation would be to simply set VS Code to use the shell you are using normally: How to change the integrated terminal in visual studio code or VSCode

这篇关于如何让conda命令在Vscode的集成终端和普通终端中匹配行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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