PyQtBuilder and Python from source on Windows

Patrick Stinson patrickkidd at
Sun Oct 11 18:40:31 BST 2020

For what it’s worth, that means that sip is not meant to be used with a customs Python built from source on windows.

However, I will say this is no longer a priority for me since I finally had luck with a installer using sip and pyqt on windows with my in-app plugin. This was made possible by all the basic changes to sip 5 as a build system. Which is excellent.

> On Oct 11, 2020, at 8:40 AM, Phil Thompson <phil at> wrote:
> As it says in the docs, py-include-dir is the name of the directory containing the Python.h file and distutils.sysconfig.get_python_inc() is documented as returning a single directory.
> Phil
>> On 07/10/2020 01:05, Patrick Stinson wrote:
>> Phil,
>> Here is a pyqtbuild workaround that got me moving again. No idea if it
>> is clean enough but demonstrates the problem.
>> --- a/
>> +++ b/
>> @@ -386,9 +386,15 @@ macx {
>>                     'QMAKE_LFLAGS += -Wl,--version-script={}.exp'.format(
>> -        pro_lines.append(
>> -                'INCLUDEPATH += {}'.format(
>> -                        self.qmake_quote(project.py_include_dir)))
>> +        # pks
>> +        if ';' in project.py_include_dir:
>> +            py_include_dir_parts = project.py_include_dir.split(';')
>> +        else:
>> +            py_include_dir_parts = [project.py_include_dir]
>> +        for part in py_include_dir_parts:
>> +            pro_lines.append(
>> +                    'INCLUDEPATH += {}'.format(
>> +                            self.qmake_quote(part)))
>>         # Python.h on Windows seems to embed the need for pythonXY.lib, so tell
>>         # it where it is.
>>>> On Oct 4, 2020, at 10:46 PM, Patrick Stinson <patrickkidd at> wrote:
>>> Maybe this is because sip is not handling the paths correctly?
>>> Here is the first failing args to cl.exe. Note the paths returned from distutils.sysconfig.get_python_inc() are correct but sip doesn’t separate them on the ‘;’ token, and then maybe also doesn’t use the correct os.sep?
>>> cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DPy_LIMITED_API=0x03040000 -DNDEBUG -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -D_WINDLL -I. -I. -I.. -IC:/familydiagram/vendor/sysroot-dev/Python-3.7.8/include;C:/familydiagram/vendor/sysroot-dev/Python-3.7.8/PC -IC:\familydiagram\vendor\sysroot-dev\Qt-5.15.1\mkspecs\win32-msvc -Forelease\ @C:\Users\patrick\AppData\Local\Temp\nm1BE7.tmp
>>>> On Oct 4, 2020, at 10:43 PM, Patrick Stinson <patrickkidd at> wrote:
>>>> sip-build for PyQt5 fails to find Python.h with Python [3.7.8] built from source on Windows [10]. I imagine this has to do with how the python source seems to have no notion of an install prefix on Windows and leaves binaries in the build dir.
>>>> Is there any way to specify include dirs and probably also lib dirs to sip-build for PyQt5? Python headers are in <PY_SOURCE>\include and <PY_SOURCE>\PC.
>>>> -Patrick

More information about the PyQt mailing list