[英]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.