After several days searching the Internet for a solution, I finally stumbled upon this blog post that helped me create an .exe to run the program on Windows, which was my main goal.
For future reference, we have completed the following steps:
Make sure you have Python installed, with GTK + 3 ( install here ) and PyGObject ( install here ). IMPORTANT When installing PyGObject, make sure you select Gtk + AND Gstreamer (for some reason you must have it for py2exe to get all the DLLs)
In the same directory as your project, create a new python file containing the following script. Make sure you change "main.py" to the name of your own main script file (the one that runs your application):
setup.py:
from distutils.core import setup import py2exe import sys, os, site, shutil site_dir = site.getsitepackages()[1] include_dll_path = os.path.join(site_dir, "gnome") gtk_dirs_to_include = ['etc', 'lib\\gtk-3.0', 'lib\\girepository-1.0', 'lib\\gio', 'lib\\gdk-pixbuf-2.0', 'share\\glib-2.0', 'share\\fonts', 'share\\icons', 'share\\themes\\Default', 'share\\themes\\HighContrast'] gtk_dlls = [] tmp_dlls = [] cdir = os.getcwd() for dll in os.listdir(include_dll_path): if dll.lower().endswith('.dll'): gtk_dlls.append(os.path.join(include_dll_path, dll)) tmp_dlls.append(os.path.join(cdir, dll)) for dll in gtk_dlls: shutil.copy(dll, cdir) # -- change main.py if needed -- # setup(windows=['main.py'], options={ 'py2exe': { 'includes' : ['gi'], 'packages': ['gi'] } }) dest_dir = os.path.join(cdir, 'dist') if not os.path.exists(dest_dir): os.makedirs(dest_dir) for dll in tmp_dlls: shutil.copy(dll, dest_dir) os.remove(dll) for d in gtk_dirs_to_include: shutil.copytree(os.path.join(site_dir, "gnome", d), os.path.join(dest_dir, d))
Run setup.py, preferably from the command line, by typing python setup.py py2exe , and it will create two new directories in the project folder: \ build and \ dist . The \ dist folder is the one we care about, in which you will find all the necessary Dlls and your newly created .exe program, named after your main python script (main.exe in my case).
An important additional note: if you use any file other than python in your project (css file in my case), be sure to copy and paste it into \ dist , or the application will not be able to find it!
As far as I know, this solution only works for distribution for Windows (this was my main goal), but in the future I will try to do the same for Linux and OSX, and I will update the answer accordingly
source share