Ich habe versucht mit cx_freeze eine EXE von einer Python Gtk3 Application zu wandeln.
Die EXE wird erstellt nur gibt es bei der Ausführung leider einen Import-Fehler:
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", in <module>
exec code in m.__dict__
File "ProjectPlan.py", line 10, in <module>
File "C:\Python27\lib\site-packages\gi\__init__.py", line 30, in <modu
from ._gi import _API
File "ExtensionLoader_gi__gi.py", line 22, in <module>
File "ExtensionLoader_gi__gi.py", line 14, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
Code: Alles auswählen
import os, site, sys
from cx_Freeze import setup, Executable
## Get the site-package folder, not everybody will install
## Python into C:\PythonXX
site_dir = site.getsitepackages()[1]
include_dll_path = os.path.join(site_dir, "gi")
## Collect the list of missing dll when cx_freeze builds the app
missing_dll = ['libgtk-3-0.dll',
'libgdk-3-0.dll',
'libatk-1.0-0.dll',
'libcairo-2.dll',
'libcairo-gobject-2.dll',
'libgdk_pixbuf-2.0-0.dll',
'libjpeg-8.dll',
'libpango-1.0-0.dll',
'libpangocairo-1.0-0.dll',
'libpangoft2-1.0-0.dll',
'libpangowin32-1.0-0.dll',
'libgirepository-1.0-1.dll',
'libffi-6.dll',
'libfontconfig-1.dll',
'libfreetype-6.dll',
'libgio-2.0-0.dll',
'libglib-2.0-0.dll',
'libgmodule-2.0-0.dll',
'libgobject-2.0-0.dll',
'libpng15-15.dll',
'libpyglib-gi-2.0-python-0.dll',
'libxml2-2.dll',
'zlib1.dll',
'libgnutls-26.dll',
'librsvg-2-2.dll',
'libgcrypt-11.dll',
'libp11-kit-0.dll']
gtk_libs = ['lib/gdk-pixbuf-2.0',
'lib/girepository-1.0',
'share/glib-2.0',
'share/gtk-3.0']
## We also need to add the glade folder, cx_freeze will walk
## into it and copy all the necessary files
## Create the list of includes as cx_freeze likes
include_files = []
for dll in missing_dll and gtk_libs:
if os.path.exists(os.path.join(include_dll_path, dll)):
include_files.append((os.path.join(include_dll_path, dll), dll))
base = None
## Lets not open the console while running the app
if sys.platform == "win32":
base = "Win32GUI"
base = None
executables = [
Executable("ProjectPlan.py",
base=base
)
]
buildOptions = dict(
compressed = True,
includes = ["gi", "gobject"],
packages = ["gi"],
include_files = include_files
)
setup(
name = "ProjectPlan",
author = "Jonas",
version = "0.8.3",
description = "ProjectPlan: Manage your Projects",
options = dict(build_exe = buildOptions),
executables = executables
)