Converting Pyw to exe using py2exe seems to be complicated, and it does, but in fact, it’s just a simple step once you know how to do it.
I made this tutorial, because I had to convert a pyw Python file, to an exe file.
I have never used py2exe or phyton before, so I had to look around to find a way how to do it (converting pyw to exe with py2exe).
There are some tutorials which I found in Google, however, I am not a techie person, I needed a long time, to finally figure it out.
Also, because to me, video learning is much easier, I decided to create a video in case you also have similar problems.
What you need to install is of course the py2exe. And since I am using Python 2.7, I downloaded it from here. This link will go to sourceforge.net py2exe for Python 2.7.
It’s best to download from above link, because that’s from the latest Python version, I have to mention this, since I got “Python Version 2.6 required, which was not found in the registry” error message while installing py2exe.
So after Phython 2.7 and py2exe are installed, you can then go and read this tutorial page.
In this tutorial, my pyw file is called, “myfile.pyw“, so you can change the code accordingly.
Pyw to exe Using py2exe Video Tutorial
1. Create a new pyw file, and name it as “setup.pyw”, and save it to the same directory as your pyw file, which is in my case called, “myfile.pyw” in my desktop.
What you have to write or copy and paste to this setup.pyw is these codes:
from distutils.core import setup
Change the myfile.pyw accordingly to your file name. Save it.
2. Then, move or copy these two files to your Python27 folder. It should be in C:\Python27
3. Run cmd, by going to your start Windows icon (I am using Windows vista in this tutorial), type “cmd” hit enter.
4. In cmd window, type cd\ to access your local disk C.
5. Then type dir to see all the directories. You should see “Python27” directory. Type cd Python27.
6. Then type python setup.pyw py2exe wait for a few seconds until your exe file is created.
7. If everything goes ok, you should see myfile.exe file inside the “dist” folder inside Python27 directory.
I hope this can help, thank you for reading :-)