[英]Debugging Python in VS Code in Windows
I have VS Code installed on my Windows machine with the Python extension. 我在具有Python扩展名的Windows机器上安装了VS Code。 I have also installed Windows Sub-system for Linux (Ubuntu) so I have the Bash shell available.
我还安装了适用于Linux的Windows子系统(Ubuntu),因此可以使用Bash shell。 I am experimenting with combining VS Code on Windows.
我正在尝试在Windows上结合VS Code。 In VS Code, I have set my default terminal to Bash (WSL.exe).
在VS Code中,我将默认终端设置为Bash(WSL.exe)。 The code is very simple for testing:
该代码对于测试非常简单:
msg = "Hello World"
pring(msg)
I set my breakpoint on the second line so that I can see code executing. 我在第二行设置断点,以便可以看到代码正在执行。 When I launch the debugger however, the debugger does not work.
但是,当我启动调试器时,调试器不起作用。 Here is the output in the terminal:
这是终端中的输出:
bruparel@WIN-XPI7AFTJ1F:/mnt/c/Users/bharat.c.ruparel/py_work$ cd c:\Users\bharat.c.ruparel\py_work && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && set "PYTHONPATH=c:\Users\bharat.c.ruparel\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd" && C:\Users\bharat.c.ruparel\AppData\Local\Continuum\anaconda3\python.exe -m ptvsd --host localhost --port 58124 c:\Users\bharat.c.ruparel\py_work\hello_world.py "
-bash: cd: c:Usersbharat.c.ruparelpy_work: No such file or directory
As you can see above, Bash is having trouble concatenating the path. 如上所示,Bash无法连接路径。 When I switch my default terminal to the either the PowerShell or DOS, the debugger launches correctly.
当我将默认终端切换到PowerShell或DOS时,调试器将正确启动。
I am more used to the Bash prompt having used Mac and Linux for a long time. 我很习惯使用Mac和Linux了很长时间的Bash提示。 Now that I have to use Windows, I was trying to combine VS Code on windows side to use the Linux Subsystems's Bash shell.
现在我必须使用Windows,我试图在Windows上结合VS Code来使用Linux Subsystems的Bash shell。
The debugger has stopped me however. 调试器阻止了我。 Is there a way to fix this?
有没有办法解决这个问题?
Thanks. 谢谢。
VS Code的Python扩展尚不支持WSL 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.