Qt platform plugin 'windows' - py2exe

1.9k views Asked by At

I know there are many posts about this problem (i've read them all). But i still have a problem with my exe, still cannot be opened.

I've tried to put the qwindows.dll (i tried with 3 different qwindows.dll) in the folder dist with my exe but doesn't change anyhting.

I've tried with libEGL.dll, nothing.

Any suggestions ? Is there a way to avoid having this problem ?

3

There are 3 answers

2
Inktvisje On BEST ANSWER

I've had this issue aswell, after a lot of digging I found the following solution:

Copy the following file next to you main .exe: libEGL.dll

Copy the following file in a folder "platforms" next to you main .exe: qwindows.dll

Putting the qwindows.dll in the subfolder is the important part I think, hope this helps

2
Reinier Hernández On

Try:

from setuptools import setup
import platform
from glob import glob
from main import __version__, __appname__, __author__, __author_email__


SETUP_DICT = {

    'name': __appname__,
    'version': __version__,
    'description': 'description',
    'author': __author__,
    'author_email': __author_email__,

    'data_files': (
        ('', glob(r'C:\Windows\SYSTEM32\msvcp100.dll')),
        ('', glob(r'C:\Windows\SYSTEM32\msvcr100.dll')),
        ('platforms', glob(r'C:\Python34\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll')),
        ('images', ['images\logo.png']),
        ('images', ['images\shannon.png']),
    ),

    'options': {
        'py2exe': {
            'bundle_files': 1,
            'includes': ['sip', 'PyQt5.QtCore'],
        },
    }
}

if platform.system() == 'Windows':
    import py2exe
    SETUP_DICT['windows'] = [{
        'script': 'main.py',
        'icon_resources': [(0, r'images\logo.ico')]
    }]
    SETUP_DICT['zipfile'] = None

setup(**SETUP_DICT)

copy the dependency manually is a bad way to do, because py2exe take care of it. With pyqt5, this setup works, BUT if I try in other computer without pyqt install the exe crashes. I migrated to pyqt4 and run in all computers.

0
Andrii Liekariev On

For me it was enough to copy qwindows.dll to platforms folder, like @Inktvisje wrote.

And don't repeat my mistake: don't download this dll from Internet! Copy it from your Python libs folder: YourPythonFolder\Lib\site-packages\PyQt5\plugins\platforms.