简体   繁体   中英

MacOS tkinter application compiled with pyinstaller opens and immediately closes

I wrote a python app using tkinter for the gui and compiled it using pyinstaller, but when you try to open the app created by pyinstaller it opens and closes immediately and doesn't say anything. The executable works perfectly, but no matter how you open the app, with open in terminal or double-clicking it from finder, it can't open.

I've also tried it with py2app and nuitka and the executables they create work fine, but no matter what I do the application instantly closes when I open it.

To compile, I ran pyinstaller --onefile --windowed --hidden-import tkinter [python file] .

I am running python 3.8.1 on MacOS.

I'd greatly appreciate it if anyone could help, I've been struggling with this for too many hours now.

I actually found a workaround on a github page . It makes the app a little slow to open because it needs to open two apps, but it works when nothing else did.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM