简体   繁体   中英

cx_Freeze exe file opens and then closes

  1. My code converter code is down here:

     import os os.environ['TCL_LIBRARY'] = "C:\\\\Program Files (x86)\\\\Python35-32\\\\tcl\\\\tcl8.6" os.environ['TK_LIBRARY'] = "C:\\\\Program Files (x86)\\\\Python35-32\\\\tcl\\\\tk8.6" from cx_Freeze import setup, Executable if __name__.endswith('__main__'): setup(name = "Dodge The Blocks", version = "2.0", description = 'A fun little game for when your bored', executables = [Executable(r"C:\\Users\\Harshal\\Desktop\\GameWIP.py")] ) 
  2. I also wanted to ask that what does this mean:

     if __name__.endswith('__main__'): 
  1. Regarding the first part of your question: see this answer for a working setup script to freeze an application relying on tkinter using cx_Freeze 5.1.1 (and also see my comment to your question)

  2. Regarding the second part of your question

    what does this mean:

     if __name__.endswith('__main__'): 

    See What does if __name__ == "__main__": do?

    You probably got the modified version you are using from this issue or a similar one. In any case, this line and its modification might be relevant for the main application, but is not necessary in the setup script and should be removed from there.

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