#pip #python #exe #compile #dist #nsis #pyinstaller #build #executable #py
If not already done so run:
```
pip install pyinstaller
```
```
pyinstaller --onefile -w <python file.py>
```
```
pyinstaller --onefile -noconsole <python file.py> (no dos console)
```
(-w with windows gui)
(leave -w away if it is a console (DOS) file)
It creates a build and dist directory
You can delete the build directory
The exe is in the dist directory
If you have any other media file move the exe one level up.
(where the original .py file is (or was)
Zip the whole folder.
With nsis ([https://nsis.sourceforge.io/Download](https://nsis.sourceforge.io/Download)) , you can create an installer
Start NSIS, Choose installer based on zipfile, and select the zipfile
Click Generate. It might take a while