为Python3.6在Raspberry上安装PyQt5

2024-04-20 06:00:53 发布

您现在位置:Python中文网/ 问答频道 /正文

由于我的问题没有找到答案,无论是在旧的帖子还是在其他论坛上,我想向stackoverflow社区寻求建议。在

我使用的是raspberry Pi3B+,版本9.4(lite)和内核版本4.14.71-v7。在

我用Python3.6。我安装如下:

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
sudo tar xzf Python-3.6.0.tgz

sudo -s
cd Python-3.6.0
bash configure
make altinstall
exit

安装没有任何麻烦,一切工作顺利。在

现在我想为python3.6安装PyQt5模块。我通常用

^{pr2}$

用于安装python3.6的模块。尝试

sudo python3.6 -m pip install pyqt5

给了我错误信息

 Could not find a version that satisfies the requirement PyQt5 (from versions: )
 No matching distribution found for PyQt5

所以我试过了

sudo apt-get update
sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools

但是它在树莓上安装了PyQt5 for python3.5(它是预先安装的)。在

那么,有人知道如何使用或安装PyQt5来安装后续安装的 Python3.6?在

编辑日期:2019年3月8日:
谢谢你,飞鹰。我开始从源代码开始构建。我从 你的链接。在

sudo apt-get update
cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
sudo tar xzf sip-4.19.14.tar.gz
cd sip-4.19.14
sudo -s
python3.6 configure.py --sip-module=PyQt5.sip 
make
make install

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
sudo tar xzf PyQt5_gpl-5.12.tar.gz
cd PyQt5_gpl-5.12
python3.6 configure.py

然后我收到了以下错误

Error: Use the --qmake argument to explicitly specify a working Qt qmake.

我想我走的路是对的,但我不明白什么是qmake或它是什么 意味着。在

编辑日期:2019年3月10日:
我可以解决最后一条错误消息。我安装了

sudo apt-get install qt5-default

然后我做了前面提到的同样的程序。现在我知道错误了

fatal error: sip.h: File or directory not found 
#include <sip.h>

PyQt5型配置.py在:/usr/src/PyQt5_gpl-5.12中
SIP SIP.h在:/usr/src/SIP-4.19.14中

有什么主意吗?谢谢各位。在


Tags: installhttpsdevsrcgetusrsudocd
1条回答
网友
1楼 · 发布于 2024-04-20 06:00:53

今天我找到了解决办法。下面的步骤对我很有效,没有任何错误。整个过程花了将近两个小时。在

sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install sip-dev

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gz
sudo tar xzf sip-4.19.14.tar.gz
cd sip-4.19.14
sudo python3.6 configure.py  sip-module PyQt5.sip
sudo make
sudo make install

cd /usr/src
sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gz
sudo tar xzf PyQt5_gpl-5.12.tar.gz
cd PyQt5_gpl-5.12
sudo python3.6 configure.py
sudo make
sudo make install

相关问题 更多 >