如何使用绿色的“附加调试器"使用 PyCharm 的 Python 控制台中的按钮 [英] How to use the green "Attach Debugger" button in Python console using PyCharm

查看:53
本文介绍了如何使用绿色的“附加调试器"使用 PyCharm 的 Python 控制台中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用 Python 控制台左侧的这个绿色错误按钮.我已经搜索过官方文档,但似乎没有这个按钮的描述.注意我问的是左侧的按钮,而不是右上角的按钮.

I was wondering how to use this green bug button on the left side of Python console. I've been searched official documents but there seems to be no description of this button. Note I am asking the button on the left side, not the button on the right top corner.

我正在使用 IPython 控制台,发现 %debug 魔法不再可用.我想知道该按钮的用途以及如何在 IPython 控制台中使用 %debug 魔法.

I'm using IPython console and found %debug magic is not available anymore. I'd like to know what's the usage of that button and how to use %debug magic in IPython console.

推荐答案

我自己找答案的时候发现了你的问题;最终我发现了这个视频,它显示它正在使用中:https://www.youtube.com/watch?v=JcOCNgXXhmE

I found your question while searching for the answer myself; eventually I hit upon this video that shows it in use: https://www.youtube.com/watch?v=JcOCNgXXhmE

基本上,您必须在正在编辑的文件中设置断点,在控制台中导入文件,单击附加调试器"按钮,然后运行遇到断点的代码——此时,调试器工具将打开,您可以单步执行.

Basically, you have to set a breakpoint in a file you're editing, import the file in the console, click the "Attach Debugger" button and then run code that hits the breakpoint -- at that point, the debugger tool will open and you can step through it.

这不是我所希望的完全——我希望附加调试器,然后逐步执行我刚刚键入的语句,就像使用 IPython 的 %debug <statement>(仍然有效,但不提供视觉效果).

It's not exactly what I was hoping for -- I was hoping to attach the debugger and then step through a statement I'd just typed, as one can with IPython's %debug <statement> (which still works, but does not provide the visual niceties).

为此我找到的最佳解决方案是使用临时文件,键入我要逐步执行的语句,然后使用它运行调试器.

The best solution I've found for that is to use a scratch file, type the statement I want to step through, then run the debugger with that.

这篇关于如何使用绿色的“附加调试器"使用 PyCharm 的 Python 控制台中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆