Python: Make Standalone EXE for any Python Script


First of all we need to install py2exe. You will find setup files which will install this without any issues.

Find then here:

Make sure to use proper version. If you download a 32 bit version and it says "Python Installation not find in registry, or something like that", then install a 64 bit, as you may have 64 bit python. Act accordingly.

Now we have to check if it is working. Open python console and run like this:

If you see no error, you are good to go.

Now create a folder and make a file inside this folder named as Write any python script there. We will be using below script that prints output 9 times.

for i in range(1, 10):
    print('What have I done !!!!')

Now create another new file with name Write below lines in this file:

from distutils.core import setup
import py2exe


Now open command prompt, navigate to your folder and run below command:

python py2exe

You will see some output flows, but you don't need to bother with details. Now, if everything went well, you will see few folders that have just appeared magically. 

Go to "dist" folder, here you will find your exe names as  printscr.exe. This is it. Run this file and check that everything is working as intended.


  1. If you don't want console to display, you'll have to change "console=" to "window="


Post a Comment