简体   繁体   中英

How to debug in Pycharm

Is there something special I need to debug in 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. 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. 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.

So my question is really.

  1. Is Pycharm supposed to debug python out of the box?
  2. How do I setup Pycharm to debug python if not.

I am using the latest python 2.7.9 a fresh install of a few minutes ago.

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. Instead one of your lines will change a light blue (depending on your theme) to indicate you are debugging that line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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