User Tools

Site Tools


Create self contained python script


pip3 install pyinstaller

Go where your script is and execute

pyinstaller --onefile

You should get one file (named “yourscript”) that can be distributed to other Linux distros and run simply with


If there are additional files needed by the script for example you need to add this e.g.

pyinstaller --onefile --add-data '' --add-data 'secondfile.txt:.'

Paths to these additional files are relative to

Hide console window

Pass –noconsole option to pyinstaller

pyinstaller --onefile --noconsole

Tested on

  • Xubuntu 18.04.4
  • Windows 10 VM

See also


wiki/create_selfcontained_python_script.txt · Last modified: 2022/12/22 14:12 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki