How to use pyinstaller?

I would suggest to first read the Using Pyinstaller section in the documentation of the module itself.

You can also use some tutorials (e.g. Matt Borgerson’s one).

In order to recap you should:

  • write your script and make sure that it works
  • run from the command line:~\ pyinstaller your_file_name.py
  • this command will generate a your_file_name.spec file where you can include all the dll required by your application and any custom settings (Using Spec Files)
  • once you have decided what to include in your .exe application you can run from the command line~\ pyinstaller [option1] [option2your_file_name.py

You can find the full list the options in the documentation. An example could be pyinstaller.exe –onefile –windowed –icon=app.ico app.py where:

  • –onefile: Create a one-file bundled executable.
  • –windowed: Parameter to chooseif you are compiling in Mac OS X or Windows
  • –icon= : Choose the file to use as icon for file.

You can create your exe file very easily also with py2exe.

Leave a Comment