导入任何与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。
通过升级pip包“ prompt_toolkit”可以解决该问题
$ pip3 install --upgrade prompt_toolkit # optionally --user
对我来说,它从2.0.10版本升级到了3.0.5。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句