0

I installed Python 3.7 on my raspberry pi with the help of Installing Python 3.7.0 on Raspbian tutorial and wanted to use it to start my script which uses PyQt5 but its throwing a ModuleNotFoundError. PyQt5 is installed and working with 3.4.2 why is it not working with 3.7 ?

Traceback (most recent call last):
  File "gui.py", line 8, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'

Thanks in advance for any kind of help !

2

You can't install an out-of-distribution Python version and expect system Python packages to work. They're compiled for Python 3.5 that's included in the distribution.

I suggest you upgrade to Buster (unreleased/testing) to get system Python 3.7 and PyQt from the distribution.

To upgrade to Buster, edit /etc/apt/sources.list and replace stretch with buster on both lines, then run apt update and apt dist-upgrade.

  • Wait, are you on Raspbian Jessie? First start from a new Stretch image, then upgrade to Buster. – ben_nuttall Mar 14 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.