Exe file is also known as executable file. So here we’ll see how to convert .py file to .exe file.
- Firstly we have to install pyinstaller.
- Go to command prompt.
- Run the following command.
- pip install pyinstaller.
- Then we will go to the location where our python program is saved. Click shift and right click together .
- We’ll see an open list like given below.
- Click open PowerShell windows here. And we’ll see a PowerShell windows .
- Then write the command pyinstaller –onefile -w ‘filename.py’. Here our filename is hello.py.
pyinstaller --onefile -w 'filename.py'
- Then go to dist folder and see the .exe file of same name.
This is how we can convert .py file into .exe file.