[英]VS Code, how to specify the startup file for python
我在 VS Code 中运行一个 Python 应用程序,每次运行它时我都必须打开代码开始的文件。 有时我正在查看的文件不同,而且必须始终记得再次打开该页面,这很烦人。 为了解决这个问题,我尝试更改 launch.json 文件,但它不起作用;
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// "program": "${file}",
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/lecture1nn.py",
"console": "integratedTerminal"
}
]
}
如果您试图在启动时执行一个一致的脚本,您可以定义一个sitecustomize
模块, site
模块将始终导入该模块。 这样你就可以让sitecustomize
中的代码在启动时做你想做的事情作为副作用。 有关详细信息,请参阅site
模块文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.