How To Convert Python File to EXE
I am Gajesh Naik. I am 12 years old. I started programming at the age of 7. I have skilled 9 P. Lang
Convert Python to EXE
Install the library pyinstaller.
Type below command in the command prompt.
Go into the directory where your ‘.py’ file is located.
Press shift⇧ button and simultaneously right click at the same location. You will get below box.
Click on ‘Open PowerShell window here’.
You will get a window shown below.
Type the command given below in that PowerShell window.
pyinstaller --onefile -w 'filename.py'
My ‘.py’ file name is ‘1’.
In case you get an error at this point in the PowerShell window like this:
The correction while typing the above command:
.\pyinstaller --onefile -w 'filename.py'
After typing the command ‘Hit the Enter’.
It will take some time to finish the process depending on the size of the file and how big is your project.
After the processing has been finished, the window will look as below:
See the directory it should look like this:
‘build’ folder and ‘1.spec’ is of no use. You can delete these if you want, it will not affect your ‘.exe’ file.
Open ‘dist’ folder above. Here you will get your ‘.exe’ file.
Right-click on the file and check the properties.
Previously published at http://gajeshsnaik.codes/convert-python-to-exe/
Subscribe to get your daily round-up of top tech stories!