PyInstaller: Single-file executable doesn't run
I managed to solve this issue.
I found out that the program actually did run. However, it hanged for a long time (like 5 minutes!) before displaying the Hello, World!
message.
Actually, the problem was caused by UPX (Ultimate Packer for eXectutables), a tool that aims to reduce the size of executable files. PyInstaller uses UPX by default if it finds it in the system. For reasons that I still can't grasp, the UPX-packed executable took an extremely long time to self-extract and run.
So, simply running the command with the --noupx
option fixed the problem.
pyinstaller --debug --onefile --noupx test.py
For more information, check out the GitHub issue.