一开始以为是虚拟环境设置的问题。
搜索vscode 使用虚拟环境调试,出来一大堆,下面这个是比较详细的。
https://www.yuque.com/rebooting/blog/whfzge
然鹅好像跟我的问题无关,我的问题是这样的:
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": [
{
"python":"D:\\workspace\\vs_test_venv\\Scripts\\python.exe",
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
}
]
}
断点打在自己的代码上,是可以正常停住的。但是打在三方库的代码里面,停不住。
如图,断点是灰色的。而且,从外面点击step in也没有反应的。
鼠标指针移上去,问题清楚了:
弹出来一个框:
Breakpoint in file excluded by filters.
Note: may be excluded because of "justMyCode" option (default == true).Try setting "justMyCode": false in the debug configuration (e.g., launch.json)
原来是默认只调试自己的代码,修改launch.json就好了:
"console": "integratedTerminal",
"justMyCode": false, // 根据说明在launch.json里面加上这一行即可
}