【发布时间】:2020-05-22 19:01:27
【问题描述】:
导入任何与 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。
【问题讨论】:
-
这不是 Qt 错误,而是 ipython 错误
-
知道去哪里看吗?