The best and easiest way is auto-py-to-exe for sure, and I have given all the steps and red flags below which will take you just 5 mins to get a final .exe file as you don’t have to learn anything to use it.
1.) It may not work for python 3.9 on some devices I guess.
2.) While installing python, if you had selected ‘add python 3.x to path’, open command prompt from start menu and you will have to type
pip install auto-py-to-exe to install it. You will have to press enter on command prompt to get the result of the line that you are typing.
3.) Once it is installed, on command prompt itself, you can simply type just
auto-py-to-exe to open it. It will open a new window. It may take up to a minute the first time. Also, closing command prompt will close auto-py-to-exe also so don’t close it till you have your .exe file ready.
4.) There will be buttons for everything you need to make a .exe file and the screenshot of it is shared below. Also, for the icon, you need a .ico file instead of an image so to convert it, you can use https://convertio.co/
5.) If your script uses external files, you can add them through auto-py-to-exe and in the script, you will have to do some changes to their path. First, you have to write
import sys if not written already, second, you have to make a variable for eg,
location=getattr(sys,"_MEIPASS",".")+"/", third, the location of example.png would be
location+"/example.png" if it is not in any folder.
6.) If it is showing any error, it may probably be because of a module called setuptools not being at the latest version. To upgrade it to the latest version, on command prompt, you will have to write
pip install --upgrade setuptools. Also, in the script, writing
import setuptools may help. If the version of setuptools is more than 50.0.0 then everything should be fine.
7.) After all these steps, in auto-py-to-exe, when the conversion is complete, the .exe file will be in the folder that you would have chosen (by default, it is ‘c:/users/name/output’) or it would have been removed by your antivirus if you have one. Every antivirus has different methods to restore a file so just experiment if you don’t know.
Here is how the simple GUI of auto-py-to-exe can be used to make a .exe file.