Get a Windows message when trying to generat executable python file

Message from Windows: “This app cannot run on your PC
Contact the publisher of the software to find a version suitable for your PC”.

I have 64bit PC
64bit version of Python 3.12.5
Windows 11 Pro

Everything was fine for some months ago but when adjusting the app this week and try to generate exe I only get this message. I uninstalled pyhton and reinstalled.

Please provide details.
What app? Do you mean Python?
Where did you get it and what is its version?
How are you trying to run the app?

The message was the blue windows message.

Python 3.12.5
Run it from cmd
Got it from Python.org

You will need to share a screen shot. I do not know that this is.

I see that you are using the PyInstaller package.

Now I understand what you mean by “generate exe”.

Please confirm that python itself runs.

python.exe

Then try this

python.exe -m PyInstaller

The same message appears with python.exe and
python.exe -m PyInstaller

Try the command

py.exe

Does that also get the error?

py.exe gives me this: Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

I’m not know what you are running that is called python.exe, likely the app store stub to trigger a python install.

Instead of using python.exe use py.exe and you should be good.

py -m PyInstaller

@Raglefant, additionally the py --list command might help you figure out what Python interpreters are detected (which would mean that they are correctly installed, and anything else might need to be removed or reinstalled, it is up to you). And here is the documentation for py the Python Launcher for Windows (the whole page might be a useful read for you anyway).

It now works. Changed python.exe -m pyinstaller — onefile filename.py
To

py.exe -m pyinstaller — onefile filename.py

Thanks for your time with this though.
Have a nice day😊