我应该怎么做才能让 PyQt4 工作?

发布于 2024-09-28 02:06:16 字数 466 浏览 4 评论 0原文

在 ubuntu 上安装了 python-qt4 和 pyqt4-dev-tools 软件包

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v8.0 but the PyQt4.QtGui module requires API v7.1

我应该做什么才能让 PyQt4 工作?

Installed python-qt4 and pyqt4-dev-tools packages on ubuntu

Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v8.0 but the PyQt4.QtGui module requires API v7.1

What Should i do to get PyQt4 working?

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

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

发布评论

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

评论(2

残花月 2024-10-05 02:06:23

我也有同样的问题。我清理并删除了所有安装文件,然后按照以下说明重新开始:

如果你想将它与 2.7 以外的 python 版本一起使用
将下面说明中的每个 2.7 替换为您正在使用的版本
它应该可以工作(使用 2.6 和 3 进行测试)。

首先,您需要一些先决条件: sudo apt-get install python-pip
python2.7-dev libxext-dev python-qt4 qt4-dev-tools build-essential

然后,尝试使用 pip 安装 PyQt 和 SIP(​​它失败了,但它
将所需的包下载到您的 ~/build/ 文件夹)。点安装
PyQt pip 安装 SIP

之后转到 ~/build/SIP 并安装它 cd ~/build/SIP python2.7
configure.py make sudo make install

最后进入 ~/build/PyQt 并安装它 注意:因为 PyQt 很大
项目 - 构建它可能需要一些时间.. cd ~/build/PyQt python2.7
configure.py make sudo make install

来源: http://problemssol.blogspot.com/2010/12/compile-and-install-pyqt4-for-python27.html

I had the same problem. I cleaned, erased all the files of installation and started all over again following these instructions:

If you want to use it with different version of python than 2.7 than
replace every 2.7 in instructions below with the version you are using
and it should work (tested with 2.6 and 3).

First, you need some prerequities: sudo apt-get install python-pip
python2.7-dev libxext-dev python-qt4 qt4-dev-tools build-essential

Then, try to install the PyQt and SIP using pip (it fails but it
downloads the required packages to your ~/build/ folder). pip install
PyQt pip install SIP

After that go to ~/build/SIP and install it cd ~/build/SIP python2.7
configure.py make sudo make install

Finally go to ~/build/PyQt and install it Note: as PyQt is a big
project - building it may take some time.. cd ~/build/PyQt python2.7
configure.py make sudo make install

Source: http://problemssol.blogspot.com/2010/12/compile-and-install-pyqt4-for-python27.html

独孤求败 2024-10-05 02:06:22

看起来你的 apt 源列表搞砸了。转到 apt-get updateapt-get Upgrade pyqt* python-qt4 并重试。

Looks like your apt source list messed up. Go apt-get update and apt-get upgrade pyqt* python-qt4 and try again.

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