问题描述
我已经卸载了 conda(Miniconda3) 和 VSCode,之后我手动安装了 python 并重新安装了 VSCode。但是,每当我启动编辑器或运行调试器时,VSCode 都会尝试使用 conda.exe。
& : The term 'C:\ProgramData\Miniconda3\Scripts\conda.exe' is not recognized as the name of a cmdlet,function,script file,or operable program. Check the spelling of the name,or if a path was included,verify that the path is correct and try again.
At C:\Users\Victor\Documents\WindowsPowerShell\profile.ps1:4 char:4
+ (& "C:\ProgramData\Miniconda3\Scripts\conda.exe" "shell.powershell" " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\ProgramData\...ripts\conda.exe:String) [],CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
这是我不断收到的错误。我检查了我的全局 settings.json 和本地 settings.json 无济于事。 (编辑:conda.exe 不在我的用户路径或系统路径中。)
Interpreter 当我手动激活我为 Django 创建的新环境时,它可以工作。
亲切的问候, 维克多
解决方法
它是否仍在您的 Windows 环境变量中?
您可以通过以下方式进行检查:系统信息 > 高级 > 环境变量
接下来,检查用户和系统是否存在。 检查系统框中的变量路径或路径,单击编辑,看看它是否在那里。如果是这样,请从那里删除 Conda.exe。
,我找到了解决方案: 在我的文档文件夹中有一个名为“WindowsPowerShell”的文件夹,其中包含以下代码:
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "C:\ProgramData\Miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion
删除包含文件的文件夹解决了这个问题!我不知道这是怎么到那里的。康达一定以某种方式做到了这一点。