这个问题是VS code的坑,不主动更新路径
-
添加launch.json
image.png
2.修改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
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceRoot}"
},
"envFile": "${workspaceFolder}/.env"
}
]
}
- 再跑一次,就好了!!
网友评论