问题
I am stuck with one error while building PyQt5 for rasberry pi. I was successfully able to run the application which uses QQmlApplicationEngine on Windows Desktop. Now I wanted to run the same application in Raspberry pi 3. I build the PyQt5 (5.4.1v) from the source and tried running the application but I get error:
ImportError: No Module Found "PyQt5.QtQml".
I realized that, when I build the PyQt5 from the source, I get:
Project Error: Unknown module(s) in QT: qml
and shows me a list of modules which will be built.
Just for a reference, I am using a raspbian, and have installed the following before building PyQt5.
sudo apt-get update
sudo apt-get install qtcreator
sudo apt-get install qt5-qmake
added "export QT_SELECT = qt5" to my "~/.profile" and "~/.bashrc"
sudo apt-get install qt5-default qt5-qmake qtbase5-dev-tools qttools5-dev-tools build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libgl1-mesa-dev
How am I supposed to install QtQml in PyQt5? Please help...
Thanks in Advance.
回答1:
PyQt5 is (as you perhaps know) just a wrapper for the Qt C++ libraries. In order to use a specific module in PyQt5 the underlying C++ library needs to be installed.
The first error message shows that PyQt5.QtQml
module is missing which respectively leads to the conclusion that the underlying Python wrapper is missing.
The second error message is probably generated on the C++ level and means that the required Qt C++ library for this module is missing.
Since you are building PyQt5 you not only need the runtime libraries but also the development packages for Qt. For QML you need the qtdeclerative5-dev
package and the libqt5qml5
(I think that was the name for the runtime library). These of course depend on a bunch of other packages which will automatically be installed.
PS: Don't forget the SIP library which PyQt has as a dependency no matter which Qt modules you want to use.
来源:https://stackoverflow.com/questions/42036898/qtqml-installation-in-raspberry-pi