[PyQt] PyQt5 for Python 2.7 on Windows 10

Nathan Warmerdam nbwarmerdam at integrated-informatics.com
Thu Jun 1 20:56:04 BST 2017

Would this then mean that I would need to also build Qt myself with the VS for python as well?  To avoid any incompatibilities?

From: Barry Scott <barry at barrys-emacs.org>
Date: Wednesday, May 31, 2017 at 11:52 AM
To: Nathan Warmerdam <nbwarmerdam at integrated-informatics.com>
Cc: "pyqt at riverbankcomputing.com" <pyqt at riverbankcomputing.com>
Subject: Re: [PyQt] PyQt5 for Python 2.7 on Windows 10

On 31 May 2017, at 01:30, Nathan Warmerdam <nbwarmerdam at integrated-informatics.com<mailto:nbwarmerdam at integrated-informatics.com>> wrote:

Hello All,

I have built (with commercial license) PyQt5 for python 2.7.  I used VS 2015 and packaged my build with what I believe to be the appropriate windows redistributables.

That is the wrong VS version for python2.7, unless you rebuilt python 2.7 and all extensions using VS2015 you might hit bugs because of  problems with C RTL cross version mixing that does not work in all cases.

This is version you need if you are using binaries from pyton.org<http://pyton.org>: https://www.microsoft.com/en-gb/download/details.aspx?id=44266
(google visual studio for python)


With the resulting build I have had success getting it to run on an independent (i.e. not the build machine) Windows 8.1 machine.

However when attempting to get it to run on a Windows 10 I have run into the dreaded:
This application failed to start because it could not find or load the Qt platform plugin “windows”

This is usually a sign that the qt.conf is bad but why would it work on Windows 8 but not Windows 10?  Furthermore it does not work even if I put a qt.conf file right next to the python.exe.

I have followed the file structure used by Phil in the Python 3 version of PyQt5 (e.g. PyQt5\Qt\bin and PyQt5\plugins, etc) and modified the __init__.py file to set various environment variables.  Like this:

import os
import sys
dir_name = os.path.dirname(__file__)

_path = os.path.dirname(__file__) + '\\Qt\\bin;' + os.environ['PATH']
os.environ['PATH'] = _path

os.environ['QML_IMPORT_PATH'] = os.path.join(dir_name, 'Qt', 'qml')
os.environ['QML2_IMPORT_PATH'] = os.path.join(dir_name, 'Qt', 'qml')

os.environ['QT_PLUGIN_PATH'] = os.path.join(dir_name, 'Qt', 'plugins')

os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = os.path.join(dir_name, 'Qt', 'plugins', 'platforms')

However the message persists.

As I said, it works on independent Windows 8.1 machines but not with Windows 10.  Does anyone have any tips or experience or success with PyQt5 for python 2.7 on Windows 10?

With respect,
PyQt mailing list    PyQt at riverbankcomputing.com<mailto:PyQt at riverbankcomputing.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170601/ff350dc2/attachment-0001.html>

More information about the PyQt mailing list