我使用的是最新版本的VSCode,在撰写本文时是v1.60.0。在Windows操作系统下,集成终端中运行代码的默认控制台为PowerShell。我将默认的终端配置文件更改为命令提示符。现在,当我弹出一个新的终端(Ctrl + Shift + `
)时,我被拖到命令提示控制台,就像我应该的那样。
Microsoft Windows [Version 10.0.19042.1165]
(c) Microsoft Corporation. All rights reserved.
C:UsersAKDesktopDeep LearningPyTorch>C:/ProgramData/anaconda3/Scripts/activate
(base) C:UsersAKDesktopDeep LearningPyTorch>conda activate base
(base) C:UsersAKDesktopDeep LearningPyTorch>
然而,每当我在编辑器(Ctrl + Alt + N
)中运行代码时,代码继续在PowerShell控制台中运行。
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:UsersAK> cd "c:UsersAKDesktopDeep LearningPyTorch"
PS C:UsersAKDesktopDeep LearningPyTorch> python "c:UsersAKDesktopDeep LearningPyTorchtest.py"
hello world
...
我没有安装独立的PowerShell扩展,所以它可能会集成到另一个扩展中。
我如何配置VSCode不仅将我的默认终端设置为cmd.exe
,而且还在其中运行代码?
如@mklement0所示,此问题是由v1.60.1中已解决的错误引起的。