Compiling Python code
Install the pyinstaller with pip
pip install pyinstaller
Use the pyinstaller to compile the binary
pyinstaller --onefile script.py
The binary will be on the dist directory.
Create your Python code:
sh-5.2$ cat main.py print('Hello, World!') sh-5.2$ python3 main.py Hello, World!
Compile your code
sh-5.2$ pyinstaller --onefile main.py
Run the binary
sh-5.2$ dist/main Hello, World!