Python Convert python file into .exe file














































Python Convert python file into .exe file



Python Convert python file into .exe file


The python.exe is an executable file which contain program that is capable of being executed in the computer. An executable file can be run by a program in windows through a command or double click.

To convert .py file to .exe file, follow the steps given below:


STEP 1:


Go to search bar and open command prompt. Make sure that you have pip installed.
Or else go to the link below and follow the steps to install pip.

https://pip.pypa.io/en/stable/installing/

STEP 2:

 
Go to command prompt and type the following command to install pyinstaller.

pip install pyinstaller



STEP 3:


Once you have pyinstaller installed, go to the directory you want to create the executable file and copy the path of python script.

Open command prompt, type--
cd *path* 




STEP 4:


For creating your executable,  type following in the command prompt.

pyinstaller --onefile -w *filename.py*


Here the flag '--onefile' creates everything in one executable rather than having bunch of

dependency files which automatically created by pyinstaller.


'-w': while running the executable file, if you don't want console to appear, place '-w'.


Hit enter, wait for sometime until it's done.


STEP 5:


Open the directory and double click on 'dist' folder. And you can see the executable file with 
'filename.exe'.




Comments