0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks John; you are correct I had installed Python 3.6.5. I just discovered that running Thonny runs the native Python 3.4.2 and using that the import PyQt5 statement works just fine. So I guess apt-get was still installing to 3.4 instead of 3.6?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.