PyQt5 not finding installed Qt5 library

2019-08-01 04:55发布

问题:

On Ubuntu 16.0.4, I am trying to run this PyQt5 script, and I have the distributed packages for Qt5 (via apt) and PyQt5 (via pip3) installed.

Error:

sudo ./video_qt.py

Traceback (most recent call last): File "./video_qt.py", line 8, in from PyQt5 import QtWidgets, QtCore ImportError: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not >found (required by /usr/local/lib/python3.5/dist-packages/PyQt5/QtWidgets.so)

But it is there:

ls /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5

What could be going on here?

回答1:

I do not have ubuntu to check on.

I would guess that the PyQt in PyPI is not compatible with the installed Qt .so files.

Try pip3 uninstall PyQt and install PyQt from apt should get you binaries that work together.

If its not in apt, ask unbuntu to package it or build PyQt from source. Which not that hard to do.