pyqt导入问题
我在 Python 中执行此操作时遇到一些麻烦:
from PyQt4 import QtCore, QtGui
from dcopext import DCOPClient, DCOPApp
我得到的回溯是
from dcopext import DCOPClient, DCOPApp
File "/usr/lib/python2.5/site-packages/dcopext.py", line 35, in <module>
from dcop import DCOPClient
RuntimeError: the qt and PyQt4.QtCore modules both wrap the QObject class
我尝试切换导入,稍后在文件中导入 dcopext,但没有任何效果。 感谢您的任何建议。
编辑:我已将其范围缩小到一个问题:我正在使用 dcopext,它内部使用 qt3,但我希望它使用 PyQt4。
I am having some trouble doing this in Python:
from PyQt4 import QtCore, QtGui
from dcopext import DCOPClient, DCOPApp
The traceback I get is
from dcopext import DCOPClient, DCOPApp
File "/usr/lib/python2.5/site-packages/dcopext.py", line 35, in <module>
from dcop import DCOPClient
RuntimeError: the qt and PyQt4.QtCore modules both wrap the QObject class
I tried switching the imports, importing dcopext later in the file, but none worked.
Thanks for any suggestions.
Edit: I have narrowed it down to one problem: I am using dcopext which internally uses qt3, but I want it to use PyQt4.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dcopext
模块是 PyKDE3 的一部分,使用 Qt 3.x 的 KDE3 的 Python 绑定,而您使用的是 PyQt/Qt 4.x。您需要升级到 PyKDE4,它现在作为 KDE 本身的一部分发布,除非如果您想要以 KDE 3 为目标,在这种情况下您需要相应的旧版本的 Qt 和 PyQt (3.x)。
The
dcopext
module is part of PyKDE3, the Python bindings for KDE3 which uses Qt 3.x, while you're using PyQt/Qt 4.x.You need to upgrade to PyKDE4, now released as part of KDE itself, unless you want to target KDE 3 in which case you need a corresponding old version of Qt and PyQt (3.x).