I have tried to convert a .py file to .exe using pyinstaller. This was the code I used:
.py
.exe
pyinstaller
pyinstaller --onefile mainfile.py <