Navigation

    Gpushare.com

    • Register
    • Login
    • Search
    • Popular
    • Categories
    • Recent
    • Tags

    pdb调试(懒人专用)

    技术交流
    1
    1
    16
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 188****7632
      188****7632 last edited by

      对于懒得连pycharm或者vscode的同学,学习使用简单的pdb调试是必要的

      pdb有两种用法:
      非侵入式方法(不用额外修改源代码,在命令行下直接运行就能调试)

      python3 -m pdb filename.py
      

      侵入式方法(需要在被调试的代码中添加一行代码然后再正常运行代码

      import pdb;pdb.set_trace()
      

      推荐使用第二种方式
      当显示

      (Pdb) 
      

      便进入了pdb调试

      我常用的命令有这几个



      参考文献:
      https://zhuanlan.zhihu.com/p/37294138

      1 Reply Last reply Reply Quote 1
      • First post
        Last post