简体   繁体   中英

Can't import PyQt5 on Raspberry Pi with Python 3.6.5

I am attempting to run a small PyQt application on a Raspberry Pi with jesse but cannot get the PyQt5 module to import in Python 3.6

pi@raspberrypi:~ $ cat /etc/debian_version
8.0

pi@raspberrypi:~ $ python3 --version
Python 3.6.5

pi@raspberrypi:~ $ sudo apt-get install python3-pyqt5
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pyqt5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

pi@raspberrypi:~ $ sudo apt-get install pyqt5-dev-tools qttools5-dev-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
pyqt5-dev-tools is already the newest version.
qttools5-dev-tools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

pi@raspberrypi:~ $ python3
Python 3.6.5 (default, Jul  4 2019, 01:11:28)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5'
>>>

Is my import statement wrong? Is the package named something else?

No, your import statement is not wrong. No, the ( apt or pip ) package is not named something else. However, Python 3.6.5 is not the Python 3 version that shipped with Debian Jessie — that's Python 3.4.2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM