.app made using PyInstaller closes straight away?

前端 未结 4 1334
[愿得一人]
[愿得一人] 2021-02-09 03:47

I have attempted to convert my python program into a .app using PyInstaller. The actual code runs fine through IDLE, but everytime I try and run the newly converted .app, it clo

4条回答
  •  暖寄归人
    2021-02-09 03:58

    In your case, because you set the console flag to False in your .spec file, the console window will not be displayed, preventing the output of your program from being displayed. Change this flag to True.

    It is also possible that the application may be closing because it is unable to import a package or find an external file, which prevents your application from launching. To view the error messages associated with running your executable, run the .app (or .exe) file from the terminal (or command prompt): /path/to/app/dist/MyApp.app/Contents/MacOS/MyApp for Mac (in Terminal), /path/to/app/dist/MyApp.exe for Windows (in Command Prompt). This will allow you to observe any errors that may exist after the app was bundled. If the program does fail during an import statement, you may need to add a package to the hiddenimports list in the .spec file.

提交回复
热议问题