pyinstaller package python program

ready:

  • Python 3.7 
  • PC running Python environment
  • Installation pytistaller

command:

  • 语法: pyinstaller [options] script [script ..] | specfile

  • pyinstaller hello.py

Often with the parameters:

 

  -n filename

 

 

  -D create a single executable file package 

 

  -F create a bound executable file

  -w use no console window

  Or pyinstaller --hrlp can view all parameters pyinstaller -h !!

 

Start packing:

  In the execution of python files to be packaged

        pyinstaller -F -i static files \ static resource file filename .py python

 

Combat:

  

1  # Create py file the test.py 
2  
. 3  DEF Hello ():
 . 4      info_a = INPUT ( ' Enter A: ' )
 . 5      info_b = INPUT ( ' Enter B: ' )
 . 6      info + = info_a info_b
 . 7      Print (info)
 . 8      return  ' results: ' + info
 . 9  
10  
. 11  IF  the __name__ == ' __main__ ' :
 12 is      the while True: # Add infinite loop can prevent flash back 
13         Hello ()
 14  
15  
16  # packaged 
. 17  
18 is pyinstaller - F. the test.py
 . 19  
20 is  
21 is  # Add icon packing 
22 is  
23 is pyinstaller -F -i w1.ico the test.py
View Code

 

end............

Guess you like

Origin www.cnblogs.com/xiaolizikj/p/11781030.html