# pythonqt **Repository Path**: gengumeng/pythonqt ## Basic Information - **Project Name**: pythonqt - **Description**: No description available - **Primary Language**: Unknown - **License**: LGPL-2.1 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-29 - **Last Updated**: 2025-06-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PythonQt [![License](https://img.shields.io/github/license/mevislab/pythonqt.svg?color=blue)](LICENSE) PythonQt is a dynamic [Python](https://www.python.org) binding for [Qt](https://www.qt.io). It offers an easy way to embed the Python scripting language into your Qt applications. # Documentation API documentation is available at: https://mevislab.github.io/pythonqt # Licensing PythonQt is distributed under the `LGPL 2.1` license. ## Licensing of Generator The build system of PythonQt makes use of a patched version of the LGPL'ed QtScript generator, located in the `generator` directory. See the `LICENSE.LGPL` file in the generator subdirectory for details. Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) See https://code.qt.io/cgit/qt-labs/qtscriptgenerator.git for the original project. The PythonQt wrappers generated by the generator are distributed under the `LGPL` as well. The integrated preprocessor has been replaced with code from the simplecpp project, see https://github.com/danmar/simplecpp. It is licensed under the `0BSDL` license, see the `LICENSE` file in the generator/simplecpp directory. Copyright (C) 2016-2023 simplecpp team The generated wrappers are pre-generated and checked-in, so you only need to build and run the generator when you want to build additional wrappers or you want to upgrade/downgrade to another Qt version, but this requires updating the typesystems as well. # Building ## General Building PythonQt requires a couple of steps. Follow these instructions in order to get a correctly built PythonQt runtime and Qt bindings. ### Recommendations It is recommended to build the Qt bindings yourself instead of using the pregenerated ones. This ensures the bindings are compatible with your Qt version. Do not build `PythonQt.pro` directly because it will only use the pregenerated bindings! ### Environment First, you need to set a couple of environment variables, which depend on your Python and Qt installation. - `PYTHON_VERSION` Set the version of your Python interpreter. The syntax is `.`, e.g., `3.10`. - `PYTHON_PATH` This is the absolute path to the root directory of your Python installation. - `PYTHON_LIB` The absolute path to the `libs` directory in your python installation `$PYTHON_PATH/libs`. - `PYTHON_DIR` The `PYTHON_DIR` is required for non-Windows installations to find the `python-config` executable. This should have the same value as `PYTHON_PATH`. - `QTDIR` The absolute path to the root directory of your Qt installation. ### Binding Generator 1. cd into the `generator` directory 2. Run qmake on `generator.pro` `qmake CONFIG+=Release generator.pro` 3. Make the generator Use `nmake` for MSVC (Visual Studio; make sure to have the environment variables set for Visual Studio beforehand). Otherwise, use `make`. 4. Generate the bindings We use the generator executable from step 3 to generate the bindings. The location of the generator executable can vary depending on your platform (the subdirectory is named after the current configuration, e.g., `release`). On Windows, the generator is named `pythonqt_generator.exe`; on all other platforms, it is named `pythonqt_generator`. ` qtscript_masterinclude.h build_all.txt` ### PythonQt Runtime Next, we need the PythonQt runtime. 1. cd into the `src` directory 2. qmake `src.pro` `qmake CONFIG+=Release src.pro` 3. Make the runtime Use `nmake` for MSVC (Visual Studio; make sure to have the environment variables set for Visual Studio beforehand). Otherwise, use `make`. ### Extensions As a last step, we need to build the extensions. 1. cd into `extensions` 2. qmake `extensions.pro` `qmake CONFIG+=Release extensions.pro` 3. Make the extensions Use `nmake` for MSVC (Visual Studio; make sure to have the environment variables set for Visual Studio beforehand). Otherwise, use `make`. After all these steps, you should now have a fully working PythonQt runtime and Qt bindings for your Python/Qt installation 🎉. ## MinGW It is possible to build PythonQt with MinGW on Windows instead of using MSVC.