安装 pyqt4-dev-tools 时出现问题

发布于 2025-01-03 05:43:43 字数 735 浏览 1 评论 0原文

您好,我在使用 PyQt4-dev-tools 时遇到此问题,其中包括:
* 用户界面编译器(pyuic4) * 资源文件生成器(pyrcc4) * 翻译字符串查找器 (pylupdate) 当我想将从 Designer 保存的代码转换为模块时,问题就出现了:

pyuic4 untitled.ui>test.py 

我收到此错误:

Traceback (most recent call last):
  File "/usr/bin/pyuic4", line 3, in <module>
    import PyQt4.uic.pyuic
  File "/usr/lib/pymodules/python2.6/PyQt4/uic/pyuic.py", line 4, in <module>
    from PyQt4 import QtCore
RuntimeError: the sip module implements API v8.0 to v8.1 but the PyQt4.QtCore module requires API v7.1

我尝试过升级、删除并重新安装、手动安装等...

这是我所做操作的完整日志: http://pastebin.com/2DYfAwdC

PD 抱歉我的英语不好

Hello I have this problem with PyQt4-dev-tools that include:
* a user interface compiler (pyuic4)
* a resource file generator (pyrcc4)
* a translation string finder (pylupdate)
The problem comes when I want to convert my code saved from Designer into a module using:

pyuic4 untitled.ui>test.py 

and I get this error:

Traceback (most recent call last):
  File "/usr/bin/pyuic4", line 3, in <module>
    import PyQt4.uic.pyuic
  File "/usr/lib/pymodules/python2.6/PyQt4/uic/pyuic.py", line 4, in <module>
    from PyQt4 import QtCore
RuntimeError: the sip module implements API v8.0 to v8.1 but the PyQt4.QtCore module requires API v7.1

I have tried upgrade,remove and re install, manually install etc...

here is the complete log of what i did: http://pastebin.com/2DYfAwdC

PD Sorry for my bad English

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泼猴你往哪里跑 2025-01-10 05:43:43

您的 sip python 模块必须已重新安装到较新的版本,该版本现在与您的 PyQt 安装不兼容。我建议删除 sip、PyQt 和 Qt,然后重新安装它们。

检查您的 apt 是否是最新的,并确认您的 pythonpath 中没有旧的 PyQt 安装。

如果您能够成功地自行导入 PyQt,则尝试比较导入路径以确保您没有拉取另一版本的 PyQt:

# from a shell
python -c "from PyQt4 import QtCore; print QtCore.PYQT_VERSION_STR, QtCore.QT_VERSION_STR; print QtCore.__file__"

将版本和 PyQt4 位置与使用 pyuic4 时从回溯中转储的版本和 PyQt4 位置进行比较,

如果其在不同位置找到 sip 的问题,请尝试调整您的 PYTHONPATH 来确认:

import sys
sys.path.insert(0, "/usr/lib/pymodules/python2.6")

from PyQt4 import QtCore

如果这可以正常工作而不会崩溃,那么您可能应该从此处删除导致冲突的较新 sip: “/usr/lib/python2.6/dist-packages/sip.so”

Your sip python module must have been reinstalled to a newer version which is now incompatible with your PyQt installation. I would recommend removing sip, PyQt, and Qt, and then reinstalling them.

Check that your apt is up to date, and also confirm that you don't have an old PyQt installation sitting somewhere in your pythonpath.

If you are able to successfully import PyQt by itself then try comparing the import paths to make sure you aren't pulling another version of PyQt:

# from a shell
python -c "from PyQt4 import QtCore; print QtCore.PYQT_VERSION_STR, QtCore.QT_VERSION_STR; print QtCore.__file__"

Compare the versions and the PyQt4 location to the one being dumped out from your traceback when using pyuic4

If its a matter of sip being found in a different location, try adjusting your PYTHONPATH to confirm:

import sys
sys.path.insert(0, "/usr/lib/pymodules/python2.6")

from PyQt4 import QtCore

If this works without crashing, then you should probably remove the newer sip that is causing a conflict from here: "/usr/lib/python2.6/dist-packages/sip.so"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文