插件:
Remote Development
Dev Containers
Pylance
python
ssh远程连接到服务器
选择开发容器
进入容器
选择自己的虚拟环境
launch.json 文件
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: py_17", // 自定义名称
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true, // 是否 调试整个文件夹, 或单个文件
"python": "/root/miniconda3/envs/py_17/bin/python" // 虚拟环境路径
}
]
}
注意路径,最好写绝对路径。