How to --> Convert PY --> EXE

I'm a software developer based in the United Arab Emirates π¦πͺ. I enjoy coding open-source projects that solve unique, out-of-the-box problems. I love combining my hobbies like design, coding and building various cool projects with Raspberry Pi and IoT. Obsessed with Automation and Software Development.
One of the most frequent asked questions from Python Programmers
'How to Convert PY to EXE?'
The most simplest answer just to say, it is possible, and you can do it, in just a few moments and clicks!
For todays example, I am having the following Python File :)
My Python File is called main.py
name = input('What is your name?')
age = input('What is your age?')
hobby = input('What is your hobby?')
print('Hello ' + name + '! You are ' + age + ' years old. Your hobby is ' + hobby + '.')
So, let us get into it
pyinstaller
1. So first, locate the folder your Python file is located in. And type in the path powershell and press enter.

2. Enter this command in PowerShell
pip install pyinstaller

Then pyinstaller should install, I installed it before.
3. In the PowerShell Window, write the following command & press enter, edit the file name to avoid errors
So for example
pyinstaller --onefile filename.py
This is an example, so, because my python file name is main.py, I will enter the following command
pyinstaller --onefile main.py
After the command is executed we should see this message

And in our folder, we find some new folders too

4. Go into the dist folder. You will find the exe with your file name. Like main.exe.

Double-click the exe, and it should run as a Python File.
Possible errors:
When you run the exe, it runs, but when it ends, it closes instantly, so you cannot read the result, to fix the issue, end your Python Code with
input()




