top of page
Search

How to convert Python file (example.py) to an executable (example.exe) ?

  1. Open Command Prompt and navigate to the folder where .py file is located. For those unaware on how to navigate, use 'cd path' command.

  2. Run 'pip install pyinstaller'.

  3. Once pyinstaller is successfully installed, you can run 'pyinstaller --onefile -w example.py'

  4. Two folders will be created in the directory - dist and build

  5. EXE file will be in the dist folder.

# We often need our python scripts to run on other machines, but when the other machine doesn't have Python installed, it is recommended to create a .exe file and share it to the target machine. This way, the other machine can run the scripts without Python.





#python #executable

bottom of page