在emacs中调试python程序 [英] Debugging python programs in emacs
问题描述
如何在emacs中调试python程序?
我使用python-mode.el
我得到的引用像
import pdb; pdb.set_trace();
但不知道如何使用它。
键入 Mx cd
将目录更改为要调试的程序的位置。
键入 M-x pdb
。系统会提示您输入运行pdb(如下):pdb
。输入程序的名称(例如 test.py
)。
在(Pdb)
提示符下,键入 help
了解如何使用pdb。
或者,您可以将
import pdb
pdb.set_trace()
在程序内(例如 test.py
)。现在键入 M-x shell
以获取shell提示符。当您运行程序时,您将被转储到 pdb
中,执行 pdb.set_trace()
。
How to debug python programs in emacs?
I use python-mode.el
I get reference like import pdb; pdb.set_trace();
but not sure how to use it.
Type M-x cd
to change directory to the location of the program you wish to debug.
Type M-x pdb
. You'll be prompted with Run pdb (like this): pdb
. Enter the name of the program (e.g. test.py
).
At the (Pdb)
prompt, type help
to learn about how to use pdb.
Alternatively, you can put
import pdb
pdb.set_trace()
right inside your program (e.g. test.py
). Now type M-x shell
to get a shell prompt. When you run your program, you'll be dumped into pdb
at the point where pdb.set_trace()
is executed.
这篇关于在emacs中调试python程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!