pythonwindowspyinstallerexecompatibility

EXE file from Pyinstaller does not work on another computer with different Windows version


I have successfully created an executable file, which works on my laptop (i.e.laptop used to create it) Windows 11 64-bit, Python 3.9, I used Pyinstaller to do so using the command

pyinstaller check_data.py --onefile

It works perfectly.

However, it does not work on another machine, which is Windows 10 64-bit and does not have Python installed. The whole point of the .exe is to avoid installing Python on other machines. I would like to have it functional everywhere irrespectively if python is there. On the other machine, it does not give me any error, it just does not work (I see the black prompt windows opening and closing instantly, without printing any output nor error message).

Do you think that is a Window's compatibility issue? Is there a work-around to this?

I have tried to include the python39.dll file in the folder as suggested here https://stackoverflow.com/questions/65704901/pyinstaller-exe-not-working-on-other-computerwith-other-windows-ver but it does not work!

Thanks a lot in advance


Solution

  • Try either one of the following issues: First) Maybe your script uses a library which set the None value for "sys.stdout" and "sys.stderr" when you are using Pyinstaller. Try the following code at the begining of your script.

    import sys, io
    buffer = io.StringIO()
    sys.stdout = sys.stderr = buffer 
    

    Second) Place your your EXE file in a same folder which you want to install it. In other words, do not change the installation path when you are installing your EXE file.