To convert your python source code to exe, you have to install pyinstaller. For that run cmd (command prompt) as administrator. Once in there, write any of these commands:
pip install pyinstaller
pipx install pyinstaller
sudo easy_install -U pyinstaller
sudo easy_install-x -U pyinstaller
Substitute ‘x’ with your python version, you can also substitute ‘x’ with 2 or 3 if you have Python-2.x or Python-3.x respectively. For example I have Python-3.5 so I will write them as pip3.5 install pyinstaller or pip3 install pyinstaller or sudo easy_install-3.5 -U pyinstaller.
Once you press enter it should start downloading the required files, and it will automatically install them for you. Now, to convert your .py to .exe, all you have to do in cmd is to open up the file directory where .py is located. For example,
The name of the file I want to convert is ‘Project_1’, now write this command:
It will convert your file, and will make new folders ‘dist’ and ‘Build’. You can delete the folder with name Build, your exe will be located in folder ‘dist\your_filename’.
Note: to run .exe you need all of the files in that folder.