RuntimeError:qtutils仅与PyQt4的版本2兼容

时间:2018-04-19 21:34:19

标签: python-2.7 qt4 qtcore

我正在尝试运行的程序是在anaconda环境中导入以下软件包:

from PyQt4 import QtCore, QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4

我按照this link

中的说明安装了PyQt4

但是,安装后我收到以下错误:

RuntimeError: qtutils is only compatible with version 2 of the  PyQt4 API.Whilst you can import PyQt4 prior to importing qtutils (in order to tell qtutils to use PyQt4), either set the API version to 2 yourself, or import qtutils (which will set it for you) prior to importing QtGui or QtCore.

该程序正在尝试导入

from PyQt4 import QtCore, QtGui
from qtutils import inmain_later,inthread,inmain

你有什么建议吗?

1 个答案:

答案 0 :(得分:0)

如错误消息所述,请在导入qtutils之后导入PyQt4。

Qtutils将PyQt4 sip API设置为版本2,这必须在导入PyQt4之前完成。