πͺ PyInstaller Guide πͺ
This repository explains how to use PyInstaller to convert Python scripts into standalone executables (.exe files).
With PyInstaller, you can secure and distribute your Python programs with ease.
π Example Scripts π
Here are some example scripts that demonstrate how PyInstaller works:
hello_world.py
This is a simple Python script that prints "Hello, World!" to the console.
print("Hello, World!")
complex_script.py
This is a more complex script that could include external dependencies and requires additional considerations when converting to an executable.
import sys
def main():
print(f"Arguments: {sys.argv}")
if __name__ == "__main__":
main()
π οΈ How to Convert a Python Script to an Executable π οΈ
Follow these steps to convert your Python script into an executable:
Navigate to the directory containing your script:
cd path/to/your/script
Run PyInstaller to create the executable:
pyinstaller --onefile hello_world.py
π PyInstaller Settings π
--key Setting
The `--key` setting in PyInstaller is used for encryption. It specifies a key to encrypt the content of the bundled executable.
This can be useful if you need to protect the source code or sensitive data.
pyinstaller --onefile --key YOUR_SECRET_KEY your_script.py
In this command, `YOUR_SECRET_KEY` is a string you provide. PyInstaller will use this key to encrypt the content of the executable, making it harder to reverse-engineer.
README.md inspired by https://github.com/billythegoat356/