PyInstaller: Single-file executable doesn't run

前端 未结 1 1115
一生所求
一生所求 2020-12-24 15:14

I\'m trying to create a single-file executable for Windows from a Python application, using pyinstaller.

I downloaded the experimental Python 3 branch o

相关标签:
1条回答
  • 2020-12-24 15:51

    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.

    0 讨论(0)
提交回复
热议问题