This document describes how to build the SARibbon Python bindings (PyQtSARibbon) from source, for both PyQt5 and PyQt6.
| Document | Content |
|---|---|
| Build PyQt Bindings | Compile and install PyQtSARibbon (PyQt5/6) |
| Build PySide6 Bindings | Compile and install PySideSARibbon (Shiboken6) |
| Use Python Bindings | Use SARibbon in Python |
| Software | Version | Description |
|---|---|---|
| Python | 3.8 or higher | 3.10+ recommended |
| PyQt5 | 5.15.4 or higher | Python Qt bindings |
| Qt | 5.15 or higher | C++ Qt framework |
| sip | 6.0.2 or higher | PyQt build tools |
| PyQt-builder | 1.6 or higher | PyQt build system |
| C++ Compiler | MSVC 2019+ / GCC 9+ | Native code compiler |
| Software | Version | Description |
|---|---|---|
| Python | 3.8 or higher | 3.10+ recommended |
| PyQt6 | 6.2 or higher | Python Qt bindings |
| PyQt6-sip | 13.4 or higher | SIP support for PyQt6 |
| Qt | 6.2 or higher | C++ Qt framework |
| sip | 6.0.2 or higher | PyQt build tools |
| PyQt-builder | 1.6 or higher | PyQt build system |
| C++ Compiler | MSVC 2019+ / GCC 9+ | Native code compiler |
pip install PyQt5 PyQt5-sip PyQt-builderpip install PyQt6 PyQt6-sip PyQt-builderqmake --version# Use "x64 Native Tools Command Prompt for VS 2019"
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" x64sudo apt-get install build-essentialgit clone https://github.com/czyt1988/SARibbon.git
cd SARibbonsip-build --build-dir build-pythonThe project includes pyproject-pyqt6.toml for PyQt6 builds. Use the build script with the --pyqt6 flag:
tools\build_python_bindings.bat --pyqt6Or manually swap the config file and build:
copy pyproject-pyqt6.toml pyproject.toml
sip-build --build-dir build-python6
copy pyproject.toml pyproject-pyqt6.toml!!! tip If you encounter Qt path errors, specify the qmake path explicitly:
```bash
sip-build --qmake /path/to/qmake --build-dir build-python
```
# PyQt5
xcopy /s /y build-python\PyQtSARibbon <Python_path>\Lib\site-packages\PyQtSARibbon\
# PyQt6
xcopy /s /y build-python6\PyQtSARibbon <Python_path>\Lib\site-packages\PyQtSARibbon\# PyQt5
cp -r build-python/PyQtSARibbon <Python_path>/lib/python3.x/site-packages/
# PyQt6
cp -r build-python6/PyQtSARibbon <Python_path>/lib/python3.x/site-packages/Or use pip:
pip install .python -c "from PyQtSARibbon import saribbon; print('PyQtSARibbon installed successfully!')"Error: fatal error: QtWidgets: No such file or directory
sip-build --qmake /path/to/qmake --build-dir build-pythonError: Cannot run compiler 'cl'
Use the Visual Studio Developer Command Prompt.
Error: ImportError: DLL load failed while importing PyQtSARibbon
Copy Qt DLLs to site-packages, or add Qt bin directory to PATH.
Use a virtual environment to isolate PyQt5 and PyQt6:
python -m venv venv-pyqt5
venv-pyqt5\Scripts\activate
pip install PyQt5 PyQt5-sip PyQt-builderEnsure PyQt, sip, and Python versions are compatible.
See Use Python Bindings to learn how to use SARibbon in Python.