在Visual Studio的Python Tools for Visual Studio
(url)中,当您拥有Python项目文件时,便会使用“启动文件”这一概念。
每个Python项目都有一个分配的启动文件,在解决方案资源管理器中以粗体显示。启动文件是在您开始调试时(F5或Debug> Start Debugging)或在Interactive窗口中运行项目时(Shift + Alt + F5或Debug> Python Interactive中的Execute Project)运行的文件。要对其进行更改,请右键单击新文件,然后选择“设为启动文件”。
VSCode
Python扩展中的等效项是什么?如何在目录中定位特定文件以使用从launch.json
文件中选择的当前调试设置运行
原来是program
属性。
程序-启动调试器https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes时要运行的可执行文件或文件
举个例子...
{
"name": "python launch foo",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/d1/d2/foo.py",
"cwd": "${workspaceFolder}",
"args": [ "${env:USERNAME}", "--optionX", "x1000" ]
"console": "integratedTerminal"
}
以前,我只是使用默认file
变量复制启动配置,该变量始终可以运行在工作区中打开的任何活动文件。
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}",
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句