在导入任何pyqt相关内容后,我无法在ipython中使用调试器。
如果我没有导入任何东西并且在死后调试错误,例如:
$ ipython3
In [1]: abc
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-03cfd743661f> in <module>
----> 1 abc
NameError: name 'abc' is not defined
In [2]: %debug
> <ipython-input-1-03cfd743661f>(1)<module>()
----> 1 abc
ipdb>
一切都好,但如果我使用pyqt5后端启动ipython3,我会遇到以下问题:
$ ipython3 --pylab=qt5
In [1]: abc
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-03cfd743661f> in <module>
----> 1 abc
NameError: name 'abc' is not defined
In [2]: %debug
> <ipython-input-1-03cfd743661f>(1)<module>()
----> 1 abc
ipdb> QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QApplication(0x2105860), parent's thread is QThread(0x1ccc6c0), current thread is QThread(0x7fe7940021f0)
QObject: Cannot create children for a parent that is in a different thread.
[...]
我没有使用Qt进行开发,只是将其作为Matplotlib的后端使用。我知道这个问题非常模糊,但是我不知道该去哪里寻求解决方案。
我使用的是Ubuntu 18.04,Python 3.6.9,ipython 7.14.0,pyqt5 5.14.2。