How to Run Exe From Python Quick Guide

Spread the love

Yesterday I just started working on Python and I have been trying exe I faced many problems here in this post I will discuss with you about exe like how to run exe from Python. Now I will tell in easy ways such as to the point so let’s start.

Ways to Run Exe From Python

First of all, we will have to make a file for Python so, don’t worry about anything below we have a code that helps you to make a file for python just copy the code and paste it on your file. Make sure that you installed pip pyinstaller.

pip install pyinstaller

cd PathOfFile

pyinstaller --OneFile -w ScriptName.py

(note that if you are using -w then your python file has to be an application and the file will be inside the "dist" folder)

How to run a .exe through Python

If you want to through an exe using Python then you can see just paste this code and change this line C:\Documents and Settings\flow_model\flow.exe 

import os
os.startfile("C:\Documents and Settings\flow_model\flow.exe")

 

Leave a Comment