简体   繁体   English

如何在Pycharm中进行调试

[英]How to debug in Pycharm

Is there something special I need to debug in Pycharm? 我需要在Pycharm中调试一些特别的东西吗?

I have the following code: 我有以下代码:

def main():
    print "Hello World"

if __name__ == "__main__":
    main()

and I have breakpoints on each. 而且我每个都有断点。 I hit Debug and it gives me some windows and prints both lines even though I have breakpoints on each. 我点击了Debug,即使我每个都有断点,它也会给我一些窗口并打印两行。 Is there any kind of indicator when a breakpoint is hit? 遇到断点时是否有任何指示器?

在此处输入图片说明

I have seen in other posts something about how you must setup your configuration first? 我在其他帖子中看到了一些有关如何必须首先设置配置的信息? But none of the posts seem to mention how. 但是这些帖子似乎都没有提到如何做。 Here is my configuration 这是我的配置

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Please do not link me here: https://www.jetbrains.com/pycharm/help/debugging.html I have read it and do not understand what I need to do. 请不要在此处链接我: https : //www.jetbrains.com/pycharm/help/debugging.html我已经阅读过,并且不明白我需要做什么。 I keep getting reffered to lines such as: 我不断屈从于诸如:

In the Project Structure dialog box, configure the roots, dependencies and libraries to be passed to the interpreter . 在“项目结构”对话框中,配置要传递给解释器的根目录,依赖项和库。

I am new to python and am not sure what I should be inputting into the boxes. 我是python的新手,不确定我应该输入什么。

So my question is really. 所以我的问题是真的。

  1. Is Pycharm supposed to debug python out of the box? Pycharm是否应该开箱即用地调试python?
  2. How do I setup Pycharm to debug python if not. 如果没有,我该如何设置Pycharm来调试python。

I am using the latest python 2.7.9 a fresh install of a few minutes ago. 我正在使用最新的python 2.7.9几分钟前进行的全新安装。

You set breakpoints in the gutter by clicking a wee bit to the right of the line numbers (if visible)... 您可以通过单击行号右侧的小点(如果可见)来在装订线中设置断点...

在此处输入图片说明

...and run under the "Debug" context (it's the green icon that looks like a bug of some kind). ...并在“调试”上下文下运行(它是绿色图标,看起来像某种错误)。

Well it turns out I am just a idiot. 好吧,事实证明我只是个白痴。 Though I have seen people in the debug menu complaining about the same problem. 尽管我在调试菜单中看到有人抱怨同样的问题。

You are debugging. 您正在调试。 The breakpoint does not change to indicate you have hit that line like visual studio. 断点不会更改,以表示您已达到Visual Studio之类的目标。 Instead one of your lines will change a light blue (depending on your theme) to indicate you are debugging that line. 相反,您的一行将更改为浅蓝色(取决于您的主题),以指示您正在调试该行。

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

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