【发布时间】:2022-08-05 12:11:08
【问题描述】:
VSCode\'s \"Run without Debugging\" 运行 python 文件(我可以从时间过去看出),但它没有打开任何面板/终端来显示输出。
我已经卸载/重新安装了 Microsoft python 扩展,并在退出/重新打开 VSCode 后,在带有单个 \"test.py\" 文件的全新目录中,在任何工作区之外运行上述实验。
如何让 VSCode 在“不调试运行”时打开“Python 调试控制台”?
VSCode\'s \"Run without Debugging\" 运行 python 文件(我可以从时间过去看出),但它没有打开任何面板/终端来显示输出。
我已经卸载/重新安装了 Microsoft python 扩展,并在退出/重新打开 VSCode 后,在带有单个 \"test.py\" 文件的全新目录中,在任何工作区之外运行上述实验。
如何让 VSCode 在“不调试运行”时打开“Python 调试控制台”?
您可以在setting.json 中手动设置pythonpath 的内容。
"python.pythonpPath":"the location of your python.exe" #Note that python.EXE is used here. If you use conda environment, the default configuration may be set to pythonw.exe
【讨论】:
我找到了另一种可能的解决方案。
您可以通过添加以下代码在setting.json 中指定shell:
"terminal.integrated.shell.windows":"C:\\WINDOWS\\system32\\cmd.exe",
当然,这种方法已经过时了,我们也会收到警告(但不会影响其有效性):
根据update of document,我们可以通过以下方式命名终端并指定默认终端:
{
"terminal.integrated.profiles.windows": {
"My PowerShell": {
"path": "pwsh.exe",
"args": [
"-noexit",
"-file",
"${env:APPDATA}\PowerShell\my-init-script.ps1"
]
}
},
"terminal.integrated.defaultProfile.windows": "My PowerShell"
}
【讨论】:
在菜单栏的顶部有一个名为“终端”的选项卡单击它,然后点击新终端
【讨论】: