簡體   English   中英

在macOS High Sierra上找不到Python調試器pdb

[英]Python debugger pdb not found on macOS High Sierra

PythonDebuggingTools文檔說Python調試器pdb是“所有Python安裝的一部分”,但我在macOS High Sierra下找不到它:

pdb: command not found

這些天它應該作為macOS的正常部分安裝嗎?

沒有名為pdb的命令,但您可以使用以下命令從shell調用pdb:

python -m pdb your_script.py

您可以閱讀更多方法來在其doc中調用pdb

如果你使用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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM