如何在python 2.7中在树莓派3上安装Pyqt4?

问题描述 投票:0回答:1

我刚刚在 micro SD 内存上安装了一个树莓派操作系统,以迁移到这个与 pyqt4 一起使用的系统,但我遇到了一个问题,现在我无法在这个新操作系统上安装 PyQt4,因为一切都给我带来错误。

我已经尝试过经典的了:

pip install PyQt4 sudo apt-get install python-qt4

我什至尝试从https://www.riverbankcomputing.com/software/pyqt/download手动执行此操作,但是当我按照步骤运行时

sudo python configure-ng.py

它给了我错误:

pi@raspberrypi:~/PyQt4_gpl_x11-4.12.3 $ sudo python configure-ng.py  Querying qmake about your Qt installation... Determining the details of your Qt installation... This is the GPL version of PyQt 4.12.3 (licensed under the GNU General Public License) for Python 2.7.18 on linux2. Error: This version of PyQt4 and the commercial version of Qt have incompatible licenses.

所以,我的问题是是否有人可以帮助我安装这个库,我拥有的操作系统是:

PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
python-2.7 pyqt4 qt4
1个回答
0
投票

所以我还无法解决这个问题,我建议你更新到 pyQT5,因为 4 现在被认为已经过时且不受支持。然而,我确实有一个运行着 Bullseye 的 pi,所以我尝试安装 PyQT4,这是我采取的步骤以及我走了多远。我想我已经解决了你遇到的许可证问题。

首先安装 sudo apt install build-essential python-dev

1-然后,我从https://www.riverbankcomputing.com/software/pyqt/download

下载了软件包

2-然后我必须手动安装 sip 和 sipconfig。因为pip没有通过pip在python2上正确安装sipconfig,或者通过pip3在python3上正确安装sipconfig。

我从https://github.com/ArnaudParan/python-sip/tree/master安装它 并且必须安装 sudo apt install python3-setuptools。

然后运行 sudo python setup.py devleop

3-之后我收到了这个错误 确定 Qt 安装的布局... 错误:/usr/bin/qmake 未能创建 makefile。确保你有一份工作 Qt qmake 在您的 PATH 上或使用 -q 参数显式指定工作 Qt qmake.

4-我尝试使用 apt 安装 qt4-make,但默认情况下它不可用。您必须在 /etc/apt/sources.list 中添加一行,如下所示:

deb http://security.debian.org/debian-securitybuster/updates main.

然后运行 sudo apt update。 然后你可以运行 sudo apt install qt4-make。 ofc 如果您安装了 qt5-make 请将其清除并删除。

5-然后我运行了 python3 configure.py -q /usr/lib/aarch64-linux-gnu/qt4/bin/qmake --verbose 在我在步骤 1 中下载并解压的 pyQT4 软件包存储库中,最终出现此错误。

确定 Qt 安装的布局... /usr/lib/aarch64-linux-gnu/qt4/bin/qmake -o qtdirs.mk qtdirs.pro make -f qtdirs.mk g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I。 -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I。 -o qtdirs.o qtdirs.cpp qtdirs.cpp:1:10: 致命错误: QCoreApplication: 没有这样的文件或目录 1 | #包括 | ^~~~~~~~~~~~~~~~~~~ 编译终止。 make: *** [qtdirs.mk:201: qtdirs.o] 错误 1 错误:无法确定 Qt 安装的布局

我不确定是什么导致了这个问题。但我想与你分享我的进展,它可能会帮助你解锁等等。

© www.soinside.com 2019 - 2024. All rights reserved.