1. Installation
Python3 version directly performs pip install ipdb command installation
python2.7 version needs to specify the version of IPDB
Pip Install ipdb==0.10.2
After the equals sign is the version, because the PIP install ipdb is the latest version installed by default, now the IPDB needs Python3 support
So python2.7 installation can only specify older version installation
Use of ipdb
2. Use
Python-m ipdb xxx.py
Inside the program:
From ipdb import Set_trace
Set_trace ()
3. Common commands
ENTER
(Repeat Last command)
c
Continue to
l
(Find where it is currently located)
s
(Go to subroutine)
r
(run until subroutine ends)
!<python 命令>
h
Help
- A (RGS) prints the parameters of the current function
- J (UMP) lets the program jump to the specified number of rows
- L (IST) can list code blocks that are currently going to run
- N (EXT) lets the program run the next line, if the current statement has a function call, n is not entered in the called function body
- P (rint) One of the most useful commands to print a variable
- Q (uit) exit debug
- R (Eturn) continues execution until the function body returns
- S (TEP) is similar to n, but if there is currently a function call, then s will enter the body of the called function
Python uses installation ipdb