PythonQt
Building

PythonQt requires at least Qt 5.0 and Python 2.7.x or Python 3.6 (or higher). To compile PythonQt, you will need a python developer installation which includes Python's header files and the python2x.[lib | dll | so | dynlib]. The recommended way to build PythonQt is to use the QMake-based *.pro file. The build scripts are currently set to use Python 3.10 by default. You may need to tweak the build/python.prf file to set the correct Python includes and libs on your system.

Windows

On Windows, the (non-source) Python Windows installer can be used. Make sure that you use the same compiler as the one that your Python distribution is built with. If you want to use another compiler, you will need to build Python yourself, using your compiler.

To build PythonQt, you need to set the environment variable PYTHON_PATH to point to the root dir of the python installation and PYTHON_VERSION should state the used Python version.

When using the prebuild Python installer, this will be:

> set PYTHON_PATH = c:\Python310
> set PYTHON_VERSION = 3.10

When using the python sources, this will be something like:

> set PYTHON_PATH = c:\yourDir\Python-3.10.12\
> set PYTHON_VERSION = 3.10

To build all, do the following (after setting the above variables):

> cd PythonQtRoot
> vcvars32
> qmake
> nmake

This should build everything. If Python can not be linked or include files can not be found, you probably need to tweak build/python.prf

The tests and examples are located in PythonQt/lib.

When using a Python distribution, the debug build typically does not work because the pythonxx_d.lib/.dll are not provided. You can tweak linking of the debug build to the release Python version, but this typically requires patching pyconfig.h and removing Py_DEBUG and linker pragmas (google for it!).

Linux

On Linux, you need to install a Python-dev package. If Python can not be linked or include files can not be found, you probably need to tweak build/python.prf

To build PythonQt, just do a:

> cd PythonQtRoot
> qmake
> make all

The tests and examples are located in PythonQt/lib. You should add PythonQt/lib to your LD_LIBRARY_PATH so that the runtime linker can find the *.so files.

MacOS

On Mac, Python is installed as a Framework, so you should not need to install it. To build PythonQt, just do a:

> cd PythonQtRoot
> qmake
> make all

Tests

There is a unit test that tests most features of PythonQt, see the tests subdirectory for details.