Wenn ich eine Python -Datei debuggen und den Button Python -Debugger drücken möchte: Debuggen -Python -Datei oder Debugin mit JSON, Es wählt den Standard aus. Conda -Umgebung. Und dann fragen Sie erneut, um noch einmal zu debuggen, und es funktioniert.
Es ist jedoch langweilig. Die Aktivierung von Conda Environment mit Start.json und tasks.json über "prelaununchtask" . Es wählt jedoch nicht die angegebene Konda -Umwelt aus. Mein Versuch: < /p>
Code: Select all
launch.json
Code: Select all
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal", // internalConsole -> to prevent from printing
"cwd": "${fileDirname}", // "${workspaceFolder}/src", "${workspaceFolder}",
"purpose": [
"debug-in-terminal"
],
"justMyCode": false,
"subProcess": true,
"logToFile": true,
"pythonArgs": ["-Xfrozen_modules=off"],
"env": {
"CONDA_DEFAULT_ENV": "/mnt/data/mochinski/.conda/envs/sklearn",
},
"python": "/mnt/data/mochinski/.conda/envs/sklearn/bin/python",
"preLaunchTask": "activate-conda-env",
}
]
}
< /code>
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "activate-conda-env",
"type": "shell",
"command": "conda init && conda activate /mnt/data/mochinski/.conda/envs/sklearn",
"problemMatcher": []
}
]
}
< /code>
Thanks!!