简体   繁体   English

如何配置Vscode使用WSL调试Python?

[英]how to configure Vscode to debug Python using WSL?

I found the configuration for cpp ( https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Debugger/gdb/Windows%20Subsystem%20for%20Linux.md ) and tried to change it for python debugging but it doesn't work.我找到了 cpp 的配置( https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Debugger/gdb/Windows%20Subsystem%20for%20Linux.md )并尝试将其更改为 python 调试但它不起作用。 Any suggestion to make it work?有什么建议让它工作吗?

需要说明的是,VS Code 的 Python 扩展还没有正式支持 WSL,但是已经提出了增强请求,我们确实计划支持它。

现在支持此功能,只需要安装Microsoft Python扩展并遵循此处的文档即可。

Beyond extensions installations, IDE_PROJECT_ROOTS environment variable also may affect the debugger.除了扩展安装之外,IDE_PROJECT_ROOTS 环境变量也可能会影响调试器。 For usual WSL standalone python code debugging, making sure this variable is not set (or set to the location of the files) when the VS code is opened helps.对于通常的 WSL 独立 python 代码调试,确保在打开 VS 代码时未设置此变量(或设置为文件的位置)会有所帮助。

For "step into" debugging of jupyter notebook having the python files path(s) as a part of IDE_PROJECT_ROOTS (for example export IDE_PROJECT_ROOTS="/tmp:/foo_pythonfilespath" set in.bashrc) will help to carry out "step into" python-code debugging in VSCode.对于将 python 文件路径作为 IDE_PROJECT_ROOTS 一部分的 jupyter notebook 的“步入”调试(例如export IDE_PROJECT_ROOTS="/tmp:/foo_pythonfilespath"在.bashrc 中设置),将有助于执行“步入”python - VSCode 中的代码调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM