{{tag>python}} ====== Create self contained python script ====== ===== Install ===== pip3 install pyinstaller ===== Go where your script is and execute ===== pyinstaller --onefile yourscript.py You should get one file (named "yourscript") that can be distributed to other Linux distros and run simply with ./yourscript If there are additional files needed by the script for example //settings.py// you need to add this e.g. pyinstaller --onefile yourscript.py --add-data 'settings.py:.' --add-data 'secondfile.txt:.' Paths to these additional files are relative to yourscript.py. ===== Hide console window ===== Pass ''--noconsole'' option to pyinstaller pyinstaller --onefile --noconsole yourscript.py ====== Tested on ====== * Xubuntu 18.04.4 * Windows 10 VM ====== See also ====== ====== References ====== * https://realpython.com/pyinstaller-python/