Search code examples
pythonpython-3.xpyqt4fatal-errorpyinstaller

PyQt4 script frozen by PyInstaller gives Fatal Error:"Failed to execute script xyz"


I am writing the following Python 3.5 script:

import sys
from PyQt4 import QtGui


class Window(QtGui.QMainWindow):

    def __init__(self):
        super().__init__()
        self.setGeometry(50, 50, 500, 300)
        self.setWindowTitle("HelloGUI")
        self.show()


def run():
    app = QtGui.QApplication(sys.argv)
    win = Window()
    sys.exit(app.exec_())

run()

I create executable using PyInstaller. It runs normally. Though when I try to run the executable on a different PC (which has no Python installed) than mine, it gives the following Fatal Error Message: "Failed to execute script [script-name]".

If someone has an idea how I can make my GUI programms portable, please leave a comment. Otherwise, if what I have in my mind cannot be done, please let me know.


Windows10 (64 bit), Python 3.5(32 bit), PyInstaller(3.2), PyQt4


Solution

  • Using python3.7-64bit and PyInstaller 3.6 does the job without any errors.