为了账号安全,请及时绑定邮箱和手机立即绑定

在树莓派上为 Python3.6 安装 PyQt5

在树莓派上为 Python3.6 安装 PyQt5

扬帆大鱼 2021-11-30 15:34:48
由于我在较旧的帖子和其他论坛中都没有找到我的问题的答案,因此我想向 stackoverflow 社区寻求建议。我使用的是带有内核版本 4.14.71-v7 的 raspberry pi 3B+,版本 9.4 (lite)。我使用python3.6。我是这样安装的:sudo apt-get install build-essential checkinstallsudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-devcd /usr/srcsudo wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgzsudo tar xzf Python-3.6.0.tgzsudo -scd Python-3.6.0bash configuremake altinstallexit安装没有任何问题,一切正常。现在我想为 python3.6 安装 PyQt5 模块。我通常使用sudo python3.6 -m pip install ...用于为 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 updatesudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools但是它在树莓派上为python3.5(预装)安装了PyQt5。那么有没有人知道如何为随后安装的python3.6使用或安装PyQt5?2019 年 3 月 8 日编辑:感谢 FlyingTeller。我开始从源代码构建。我按照您链接中的步骤操作。sudo apt-get updatecd /usr/srcsudo wget https://www.riverbankcomputing.com/static/Downloads/sip/sip-4.19.14.tar.gzsudo tar xzf sip-4.19.14.tar.gzcd sip-4.19.14sudo -spython3.6 configure.py --sip-module=PyQt5.sip makemake installcd /usr/srcsudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/PyQt5_gpl-5.12.tar.gzsudo tar xzf PyQt5_gpl-5.12.tar.gzcd PyQt5_gpl-5.12python3.6 configure.py然后我收到以下错误Error: Use the --qmake argument to explicitly specify a working Qt qmake.我认为我走在正确的道路上,但我不明白 qmake 是什么或其意味着什么。编辑 10.03.2019:我可以解决最后一条错误消息。我安装了sudo apt-get install qt5-default然后我做了与已经提到的相同的程序。现在我得到了错误fatal error: sip.h: File or directory not found #include <sip.h>PyQt5 config.py 在:/usr/src/PyQt5_gpl-5.12SIP sip.h 在:/usr/src/sip-4.19.14有人有想法吗?谢谢你们。
查看完整描述

3 回答

?
慕姐8265434

TA贡献1813条经验 获得超2个赞

似乎他们移动了一些东西。就获取事物和编译它们而言,这似乎有效。建造需要很长时间。

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/4.19.23/sip-4.19.23.tar.gz

sudo tar xzf sip-4.19.23.tar.gz

cd sip-4.19.23

sudo python3 configure.py --sip-module PyQt5.sip

sudo make

sudo make install


cd /usr/src

sudo wget https://www.riverbankcomputing.com/static/Downloads/PyQt5/5.13.2/PyQt5-5.13.2.tar.gz

sudo tar xzf PyQt5-5.13.2.tar.gz

cd PyQt5-5.13.2

sudo python3  configure.py

sudo make

sudo make install


查看完整回答
反对 回复 2021-11-30
?
偶然的你

TA贡献1841条经验 获得超3个赞

由于声誉而无法发表评论,但我会添加到 Christ Troutner 有用的更新答案中,以防用户遇到No module named 'PyQt5.sip'错误,请在配置期间尝试 --sip-module PyQt5.sip,根据文档:

笔记

在构建 PyQt5 v5.11 或更高版本时,您必须配置 SIP 以使用类似于以下内容的命令行创建 sip 模块的私有副本:

python configure.py --sip-module PyQt5.sip

如果您已经安装了 SIP 并且您只想构建和安装模块的私有副本,那么添加 --no-tools 选项。


查看完整回答
反对 回复 2021-11-30
?
噜噜哒

TA贡献1784条经验 获得超7个赞

今天我找到了解决方案。以下步骤对我有用,没有任何错误。整个过程用了将近两个小时。


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


查看完整回答
反对 回复 2021-11-30
  • 3 回答
  • 0 关注
  • 416 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信