PyInstaller packaged terminal after the files on the Mac can run, but the app run flash back

For example, I have here a packed, but found that the left can double-click to run the display interface, double-click on the right after the app has a direct flash back.

Solution: The code relative path all into an absolute path .

import os
import sys

# 全部拼接成绝对路径
# /Users/louis/Desktop/your_file
print(os.path.join(os.path.dirname(sys.argv[0]), 'your_file'))

If the above methods can not solve, please contact the venue Google, you can use keyword "pyinstaller mac app crash". You will find some solutions for other possibilities.

 

I welcome attention to the micro-channel public number, find more interesting content:

Published 83 original articles · won praise 157 · Views 140,000 +

Guess you like

Origin blog.csdn.net/La_vie_est_belle/article/details/100567948