在macOS High Si上找不到Python调试器pdb

2024-10-01 22:31:42 发布

您现在位置:Python中文网/ 问答频道 /正文

PythonDebuggingTools文档说Python调试器^{}是“所有Python安装的一部分”,但是我在macOS High Sierra下找不到它:

pdb: command not found

现在它应该作为macOS的正常部分来安装吗?在


Tags: 文档notmacoscommandsierra调试器pdbhigh
2条回答

如果使用IPython,则可以使用

IPython 6.2.1   An enhanced Interactive Python. Type '?' for help.

In [1]: %pdb
Automatic pdb calling has been turned ON

In [2]: %pdb
Automatic pdb calling has been turned OFF

In [3]: ?pdb
Docstring:
Control the automatic calling of the pdb interactive debugger.

Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
argument it works as a toggle.

When an exception is triggered, IPython can optionally call the
interactive pdb debugger after the traceback printout. %pdb toggles
this feature on and off.

The initial state of this feature is set in your configuration
file (the option is ``InteractiveShell.pdb``).

If you want to just activate the debugger AFTER an exception has fired,
without having to type '%pdb on' and rerunning your code, you can use
the %debug magic.
File:      ~/anaconda/envs/py36/lib/python3.6/site-packages/IPython/core/magics/execution.py

您可能需要使用pip或conda安装IPython。在

没有一个名为pdb的命令,但是您可以使用以下命令从shell调用pdb:

python -m pdb your_script.py

您可以阅读更多方法来调用its doc中的pdb。在

相关问题 更多 >

    热门问题