PyInstaller is a program that freezes (packages) Python programs into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX. Its main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.4—3.7, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
It work even if users do not have python installed.
Here an example from a github project. As you can see, you can download sources, but also a zip containing every package used to run your project. In this example, it contains many files, but you can package everything into a single .exe file.
How to use (Manual):
Install PyInstaller from PyPI:
pip install pyinstaller
Go to your program’s directory and run:
pyinstaller yourprogram.py
This will generate the bundle in a subdirectory called dist.
You can use --onefile
argument in order to generate the bundle with only a single executable file.
Case specific:
You asked how to get arguments send by the user. Here is some way to do it, more or less convenient:
- Use input(),
- Use a config file,
- Use default parameter.