This article will show you how to distribute your python software for windows 10 after you have finished creating it. In order to distribute the software written in python to the windows 10 platform’s users all you need to do is to use a python module known as PyInstaller which will help you to turn the python script into an executable application which can then be used on the windows 10 platform.
Before you can use the pyinstaller module you will need to download and install the PyInstaller module first, open up the windows command prompt and type in this command : pip install pyinstaller to install the PyInstaller module into the site-packages folder.
After you have installed the pyinstaller module then all you need to do is to browse to the folder where you have saved your python program and then run the below command in the windows command prompt.
where firstpythonproject.py is the python program which you wish to turn into an application.
Once pyinstaller has finished it’s job you should find a few folders together with your original python script and a spec file under that same folder.
Under the dist folder you will find another folder with the same name as your python script and in this folder you will find an application file which you can then double click and open it up just like any other ordinary software which runs on windows 10.
After you have started your application you will see a console window at it’s background, in order to get rid of that console you will need to do one simple change within the firstpythonproject.spec file. Open up the firstpythonproject.spec file and then change the console value from True to False within the EXE module.
exe = EXE(pyz, a.scripts, exclude_binaries=True, name='firstpythonproject', debug=False, strip=False, upx=True, console=False )
After that run this command in the windows command prompt : pyinstaller firstpythonproject.spec to regenerate all the contents within the dist directory. Now go into the dist directory again and double click on the application file to start the program without the console at it’s background.
If you want to distribute your application now then all you need to do is to upload the entire firstpythonproject folder (or zip it up) to your website so people can download it and open up the application file by double clicking on it! Although there are other tools that you can use to pack up your software but PyInstaller is the best according to my humble opinion because it is so easy to use as compared to the others.