python - 如何在 Pycharm 中调试

标签 python pycharm

我需要在 Pycharm 中调试一些特殊的东西吗?

我有以下代码:

def main():
    print "Hello World"

if __name__ == "__main__":
    main()

并且我在每个上都有断点。我点击“调试”,它给了我一些窗口并打印两行,即使我在每行上都有断点。当遇到断点时是否有任何指示器?

enter image description here

我在其他帖子中看到过有关如何首先设置配置的内容?但似乎没有一个帖子提到如何。这是我的配置

enter image description here

enter image description here

enter image description here

请不要在这里链接我:https://www.jetbrains.com/pycharm/help/debugging.html我已阅读它,但不明白我需要做什么。我不断收到诸如以下的行:

In the Project Structure dialog box, configure the roots, dependencies and libraries to be passed to the interpreter .

我是 python 新手,不确定应该在框中输入什么内容。

所以我的问题是真的。

  1. Pycharm 是否可以开箱即用地调试 Python?
  2. 如果没有,如何设置 Pycharm 来调试 python。

我正在使用几分钟前全新安装的最新 python 2.7.9。

最佳答案

您可以通过单击行号右侧的一小部分(如果可见)在装订线中设置断点...

enter image description here

...并在“调试”上下文下运行(它是绿色图标,看起来像是某种错误)。

关于python - 如何在 Pycharm 中调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28687771/

相关文章:

python - 如何用正则表达式匹配一个不以 X 开头但以 Y 结尾的单词

python - AWS Elastic Beanstalk 使用 Python 2 和 Python 3 出错?

Python tkinter 输入提示

unit-testing - 是否可以将用户输入保存在变量中以使用 intellij (pycharm) 进行连续测试

python - 找不到pip已经安装的模块

python - 将列名转换为python中的变量

python - 将 json.dump 移植到 StringIO 代码到 python 3

python - 在 Python lambda 函数中设置 PyCharm 断点

python - Python 中没有名为 QSTK 的模块

Python:OSError:[Errno 2] subprocess.Popen 上没有这样的文件或目录