1. pip install debugpy
2 . 在 QThread 线程内调用 debugpy.debug_this_thread()
3. 加入断点,调试你的程序
- # 解决 QThread 线程无法加入断点问题.
-
- from PyQt5.QtCore import *
- import ptvsd
-
- class MyTestThrad(QThread):
- def run(self):
- debugpy.debug_this_thread() # 2 调用 debug_this_thread
- print('xx')
如果执行以上步骤,还是不能命中断点的话,你就过来掐死我吧