anthpo 发表于 2023-11-24 16:36

【玄铁杯第三届RISC-V应用创新大赛】首发!在LicheePi 4A 上编译安装PyQt5

<div>在 RISC-V 环境下通过编译方式安装 PyQt5 可能会涉及到一些复杂的步骤,尤其是在没有预构建 PyQt5 包的 Linux 环境中。下面记录在RISC V环境下编译安装PyQt5的过程。</div>

<div>安装 PyQt5 的步骤</div>

<div>安装 SIP:</div>

<div>SIP 是一个方便为 C 和 C++ 库创建 Python 绑定的工具。PyQt5 使用 SIP 生成其绑定。</div>

<div></div>

<div>直接在LiPi4A的虚拟环境上执行pip install sip即可,结果如下:</div>

<div>之后,执行pip install pyqt5,安装pyqt5。</div>

<div></div>

<div>会出现错误,如下图所示:</div>

<div></div>

<div>安装pyqt5-qmake:执行sudo apt install qt5-qmake即可。</div>

<div></div>

<div>安装后,输入which qmake即可查看qmake安装路径。</div>

<div></div>

<div>下载PyQt5的安装包,地址:<a href="https://pypi.org/project/PyQt5/#files" target="_blank">https://pypi.org/project/PyQt5/#files</a></div>

<div></div>

<div>下载完成后,解压资源包。进入文件夹后,输入python configure.py --qmake /usr/bin/qmake,对编译文件进行配置。</div>

<div></div>

<div>此时会报上述错误,这里我们安装一下sip。sudo apt-get install sip-dev</div>

<div></div>

<div>再次执行后会报以下错误:</div>

<div></div>

<div>只需要在configure.py中将min_version相关的语句注释掉即可。</div>

<div>注释后,重新执行,可以看到编译过程正常执行。</div>

<div></div>

<div>配置成功后,如图所示。</div>

<div></div>

<div>执行make,进行编译,如图所示。</div>

<div></div>

<div>编译成功后的界面如下:</div>

<div></div>

<div>之后,输入sudo make install -j4进行安装,安装完毕后如下图所示。</div>

<div></div>

<div>尝试验证,进入python环境,输入import PyQt5,结果如下即为成功:</div>

<div></div>
<script src="/js/parser/searcherNewTab.js"></script>

wangerxian 发表于 2023-11-24 17:46

<p>安装PyQt5这个还这么麻烦,图形化安装会不会方便一些。</p>

chejm 发表于 2023-11-27 07:44

<p>这个帖子真是太棒了!内容丰富,观点鲜明,让人受益匪浅。感谢楼主分享</p>

大白鹅2 发表于 2024-4-11 20:40

<p>我在make之后会提示</p>

<p>/home/sipeed/Desktop/PyQt5-5.15.10/QtCore/sipQtCoreQEvent.cpp:359:58: error: &#39;EnterEditFocus&#39; is not a member of &#39;QEven &#39; 359 | {sipName_EnterEditFocus, static_cast&lt;int&gt;( ::QEvent::EnterEditFocus), 77}, | ^~~~~~~~~~~~~~ /home/sipeed/Desktop/PyQt5-5.15.10/QtCore/sipQtCoreQEvent.cpp:403:58: error: &#39;LeaveEditFocus&#39; is not a member of &#39;QEven &#39; 403 | {sipName_LeaveEditFocus, static_cast&lt;int&gt;( ::QEvent::LeaveEditFocus), 77}, | ^~~~~~~~~~~~~~ make: *** Error 1 make: Leaving directory &#39;/home/sipeed/Desktop/PyQt5-5.15.10/QtCore&#39; make: *** Error 2</p>

<p>这个我该怎么解决</p>
页: [1]
查看完整版本: 【玄铁杯第三届RISC-V应用创新大赛】首发!在LicheePi 4A 上编译安装PyQt5