首页 > 解决方案 > 错误:没有名为“PyQt5.sip”的模块 - 安装 eric6-19.03 时

问题描述

我注意到有关 stackoverflow 的许多类似问题,但没有一个能真正帮助我应对当前的挑战。我一直在尝试在我的 Raspberry Pi 设置上安装 eric6。然后我遇到了以下消息:

Checking dependencies
Python Version: 3.6.8
PyQt5 could not be detected.
Error: No module named 'PyQt5.sip'

Shall 'PyQt5' be installed using pip? (Y/n) Y
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: PyQt5 in /usr/local/lib/python3.6/site-packages (5.12)
Sorry, please install PyQt5.
Error: No module named 'PyQt5.sip'

当我尝试使用 pip 列表查看已安装的内容时(因为我之前已经设法从源代码制作和安装 PyQt5):

Package    Version
---------- -------
pip        19.0.3 
PyQt5      5.12   
setuptools 40.6.2 
sip        4.19.14

那么,我该如何克服我目前面临的问题呢?顺便说一句,我在尝试安装 eric6 时使用了以下命令:

python3 install.py

认为您可能需要知道它是否有帮助。

标签: raspberry-pipython-3.6raspberry-pi3

解决方案


Python 3.6 在任何 Raspbian 发行版中都不可用,所以我假设您自己安装了它。您不能安装分发外的 Python 版本并期望分发 Python 包能够正常工作。是的,您已经安装了 PyQt5,但它是为 Python 3.5 构建的 PyQt 版本(我假设您使用的是 Raspbian Stretch)。

有时您可以使用 pip 安装 Python 库,理论上可以为您的 Python 版本安装正确版本的 PyQt,但 PyQt 仅在 PyPI 上为 x86 提供轮子,而不为 Arm 提供轮子,因此 PyQt 不能在 pip 上安装皮。在 Raspberry Pi 上获取 PyQt 的唯一方法是通过 apt,您可以选择 Jessie(旧稳定版 - 使用 Python 3.4)、Stretch(当前稳定版 - 使用 Python 3.5)和 Buster(不稳定/测试版 - 使用 Python 3.7)。如果需要 Python >3.5,最好的办法是尝试升级到 Buster,但请记住它还没有准备好发布。


推荐阅读