PyQt5 Qt5 Runtime Libraries
The `pyqt5-qt5` package bundles a critical subset of the Qt installation required by PyQt5, enabling PyQt5 applications to run without a separate, system-wide Qt installation. It functions primarily as an internal dependency and is typically installed automatically by `pip` when the `PyQt5` package is installed. This package is licensed under the LGPL v3. As of its latest release, the current version is 5.15.18.
Warnings
- gotcha `pyqt5-qt5` is an internal dependency containing Qt binaries, not Python modules for direct user import. Attempting to `import pyqt5_qt5` will result in an `ImportError` or unexpected behavior.
- gotcha It is highly recommended to install `PyQt5` directly (e.g., `pip install PyQt5`). This will automatically pull in the compatible version of `pyqt5-qt5`. Manually installing `pyqt5-qt5` or installing an incompatible version can lead to runtime errors or crashes.
- gotcha The `pyqt5-qt5` package contains the bundled Qt libraries, making its installation size significant (tens of megabytes to over a hundred, depending on platform and version). This is expected but can impact CI/CD pipelines or environments with limited disk space.
- deprecated `PyQt5` (and thus `pyqt5-qt5`) is based on Qt 5. For new projects or to leverage the latest Qt features, consider using `PyQt6` (which uses Qt 6 and has its own `pyqt6-qt6` dependency). While much of the `PyQt5` API is similar to `PyQt6`, there are some notable changes in `PyQt6` (e.g., fully qualified enums, `exec()` instead of `exec_()`).
Install
-
pip install pyqt5-qt5 -
pip install PyQt5
Quickstart
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon
if __name__ == '__main__':
app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle('PyQt5 Hello World')
window.setGeometry(100, 100, 400, 200)
label = QLabel('Hello from PyQt5!', window)
label.move(150, 80)
window.show()
sys.exit(app.exec_())