Important: Please read the Qt Code of Conduct -

Is it possible to convert pyqt6 to exe with pyinstaller?

  • I've tried it but got error: "Failed to execute script".
    Command that i use: pyinstalle --windowed --onefile
    Python code:
    import sys
    from PyQt6 import QtWidgets

    def main():

    app = QtWidgets.QApplication(sys.argv)
    w = QtWidgets.QWidget()
    w.resize(250, 150)
    w.move(300, 300)

    if name == 'main':
    71 INFO: PyInstaller: 4.2
    71 INFO: Python: 3.7.9
    71 INFO: Platform: Windows-10-10.0.18362-SP0
    72 INFO: wrote C:\Users\Rasto\OneDrive\Documents\appp\app.spec
    74 INFO: UPX is not available.
    83 INFO: Extending PYTHONPATH with paths
    92 INFO: checking Analysis
    94 INFO: Building because pathex changed
    94 INFO: Initializing module dependency graph...
    97 INFO: Caching module graph hooks...
    108 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
    113 INFO: Analyzing ...
    1658 INFO: Processing pre-find module path hook distutils from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks\pre_find_module_path\'.
    1659 INFO: distutils: retargeting to non-venv dir 'c:\users\rasto\appdata\local\programs\python\python37\lib'
    2608 INFO: Caching module dependency graph...
    2698 INFO: running Analysis Analysis-00.toc
    2714 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
    required by c:\users\rasto\appdata\local\programs\python\python37\python.exe
    2768 INFO: Analyzing C:\Users\Rasto\OneDrive\Documents\appp\
    2785 INFO: Processing module hooks...
    2785 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2786 INFO: Excluding import of doctest from module difflib
    2787 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2790 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2876 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2878 INFO: Excluding import of doctest from module heapq
    2879 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2887 INFO: Excluding import of argparse from module pickle
    2887 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    2889 INFO: Loading module hook '' from 'c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\hooks'...
    3102 INFO: Looking for ctypes DLLs
    3102 INFO: Analyzing run-time hooks ...
    3113 INFO: Looking for dynamic libraries
    3196 WARNING: lib not found: Qt6Gui.dll dependency of c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyQt6\QtWidgets.pyd
    3201 WARNING: lib not found: Qt6Core.dll dependency of c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyQt6\QtWidgets.pyd
    3202 WARNING: lib not found: Qt6Widgets.dll dependency of c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyQt6\QtWidgets.pyd
    3300 INFO: Looking for eggs
    3300 INFO: Using Python library c:\users\rasto\appdata\local\programs\python\python37\python37.dll
    3302 INFO: Found binding redirects:
    3305 INFO: Warnings written to C:\Users\Rasto\OneDrive\Documents\appp\build\app\warn-app.txt
    3342 INFO: Graph cross-reference written to C:\Users\Rasto\OneDrive\Documents\appp\build\app\xref-app.html
    3349 INFO: checking PYZ
    3351 INFO: Building because toc changed
    3351 INFO: Building PYZ (ZlibArchive) C:\Users\Rasto\OneDrive\Documents\appp\build\app\PYZ-00.pyz
    3703 INFO: Building PYZ (ZlibArchive) C:\Users\Rasto\OneDrive\Documents\appp\build\app\PYZ-00.pyz completed successfully.
    3713 INFO: checking PKG
    3714 INFO: Building because toc changed
    3715 INFO: Building PKG (CArchive) PKG-00.pkg
    5786 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
    5788 INFO: Bootloader c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
    5788 INFO: checking EXE
    5796 INFO: Building because icon changed
    5797 INFO: Building EXE from EXE-00.toc
    5802 INFO: Copying icons from ['c:\users\rasto\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\images\icon-windowed.ico']
    5867 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
    5867 INFO: Writing RT_ICON 1 resource with 3752 bytes
    5868 INFO: Writing RT_ICON 2 resource with 2216 bytes
    5876 INFO: Writing RT_ICON 3 resource with 1384 bytes
    5877 INFO: Writing RT_ICON 4 resource with 38188 bytes
    5879 INFO: Writing RT_ICON 5 resource with 9640 bytes
    5879 INFO: Writing RT_ICON 6 resource with 4264 bytes
    5886 INFO: Writing RT_ICON 7 resource with 1128 bytes
    5891 INFO: Updating manifest in C:\Users\Rasto\OneDrive\Documents\appp\build\app\runw.exe.fjkfasmh
    5950 INFO: Updating resource type 24 name 1 language 0
    5953 INFO: Appending archive to EXE C:\Users\Rasto\OneDrive\Documents\appp\dist\app.exe
    6028 INFO: Building EXE from EXE-00.toc completed successfully.
    I would appreciate any help
    P.S. I've tried to use --path and add dll files to .spec file.

  • Si se puede ,pero también hay otras librerías para compilar a exe tu aplicación

Log in to reply