How can I make a Python script standalone executable to run without ANY dependency?
One way to make a Python script standalone executable is by using the package pyinstaller
. You can use it to create a standalone executable of your script by running the following command in your command prompt or terminal:
pyinstaller --onefile script.py
This will create a standalone executable of your script named "script" in the "dist" folder, that can run without any dependency.
You can also specify the icon and version information, etc using the --icon
and --version
option respectively
pyinstaller --onefile --icon=icon.ico --version=1.0 script.py
It is to be noted that pyinstaller only works for windows and mac, for linux you can use cx_freeze, py2app for mac and py2exe for windows.