pudb工具的查找:

 1 [root@localhost pp]# pip search pudb
 2 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
 3 django-pudb (0.1.0)      - PuDB integration for Django.
 4 pytest-pudb (0.7.0)      - Pytest PuDB debugger integration
 5 nose-pudb (1.0)          - A nose plugin for dropping into pudb on test
 6                            errors or failures.
 7 pudb (2019.2)            - A full-screen, console-based Python debugger
 8 django-pdb-pudb (0.0.1)  - Easier pudb debugging for Django. Fork of django-
 9                            pdb by Tom Christie.
10 rpudb (0.0.3)            - Remote pudb

pudb工具的安装:

 1 [root@localhost pp]# pip install pudb
 2 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
 3 Collecting pudb
 4   Downloading https://files.pythonhosted.org/packages/10/dc/a4933487ea8322336d3827c1193fff0ddd8b3a43eeda3f446f163dacc407/pudb-2019.2.tar.gz (59kB)
 5      |████████████████████████████████| 61kB 95kB/s
 6 Collecting urwid>=1.1.1
 7   Downloading https://files.pythonhosted.org/packages/45/dd/d57924f77b0914f8a61c81222647888fbb583f89168a376ffeb5613b02a6/urwid-2.1.0.tar.gz (630kB)
 8      |████████████████████████████████| 634kB 6.9kB/s
 9 Collecting pygments>=1.0
10   Downloading https://files.pythonhosted.org/packages/be/39/32da3184734730c0e4d3fa3b2b5872104668ad6dc1b5a73d8e477e5fe967/Pygments-2.5.2-py2.py3-none-any.whl (896kB)
11      |████████████████████████████████| 901kB 172kB/s
12 Building wheels for collected packages: pudb, urwid
13   Building wheel for pudb (setup.py) ... done
14   Created wheel for pudb: filename=pudb-2019.2-cp27-none-any.whl size=63236 sha256=fc9688a2316e8a0ac406941925160301b997a9218a5f65b655a7a2f62a993b24
15   Stored in directory: /root/.cache/pip/wheels/5a/17/bd/9b8fc905b71d3032f3e76757a275a25c46c6f9bbb5fcf7b5e9
16   Building wheel for urwid (setup.py) ... done
17   Created wheel for urwid: filename=urwid-2.1.0-cp27-none-any.whl size=232783 sha256=cde4afda488a22ee780ce206d0a2e350958ce2e1290286149d8cfecf25a691cf
18   Stored in directory: /root/.cache/pip/wheels/49/b5/ad/7355506059779337473b8eeb49384c9c0a9d45d34c8211a96d
19 Successfully built pudb urwid
20 Installing collected packages: urwid, pygments, pudb
21 Successfully installed pudb-2019.2 pygments-2.5.2 urwid-2.1.0
22 [root@localhost pp]# ^C

运行

pudb test.py

第一次使用会进入配置界面:

配置完成后,就可以进行调试了。
你可以先设置断点,或者直接一行一行跑。
按n是一行一行运行。
按s是进入函数运行。
按r是直接开跑,直到断点处。
在调试过程中,右边会显示变量的值:

想要进入交互模式,按ctrl-x,然后你就可以输入你想要了解的内容了:

02-11 09:05