我必须在 cx_freeze 中为 Gobject 加载哪些 DLL
What DLL's I have to load for Gobject in cx_freeze
我在使用 cx_freeze 时遇到了一些小问题,希望你们中的一位能帮助我。我已经通过这个很棒的论坛进行了搜索,但找不到答案。
我之前在 python 3.3 和 ktinker 中使用过 cx_freeze,并且工作完美。
现在我用更复杂的 gui 制作了一个小工具并尝试了 Glade。
使用 Glade 构建图形用户界面非常适合我,在 Linux 和 Windows 7 上,我制作的应用程序运行良好(在 python 解释器中)。
当我 运行 python setup.py bdist_msi
我没有看到任何错误但是当我尝试 运行 windows 中的 exe 时我得到这个错误 window:
(我不能 post 图片喷射)
最后 4 行是:
_load_backward_compatible
File "ExtentionLoader_gi_gi.py", line 22, in <module
File "ExtentionLoader_gi_gi.py", line 14, in_bootstrap_
ImportError: DLL load failed: The specified module could not be found
我不使用任何插件和外来进口,所以我必须加载的 dll 只是 Gobject 的 dll。我根据本论坛上的示例制作的安装文件。对于我的 ktinker 应用程序,我不必导入任何 dll。
最后一个问题:是否有某个地方的 dll 列表告诉我必须添加哪些 dll?
我的 setup.py 有问题吗?
代码没什么特别的,但如果你想检查它:https://github.com/EddenBeer/CodeGenerator
Python中的进口:
import csv import sys import datetime
from gi.repository import Gtk
安装于 Windows 7:
Python-3.4.2
cx_Freeze-4.3.3.win32-py3.4
pygi-aio-3.14.0_rev6-setup
Setup.py:
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, "gnome")
## 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-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',
'libgnutls-26.dll',
'libgcrypt-11.dll',
'libp11-kit-0.dll'
]
## We also need to add the glade folder, cx_freeze will walk
## into it and copy all the necessary files
glade_folder = 'glade'
## We need to add all the libraries too (for themes, etc..)
gtk_libs = ['etc', 'lib', 'share']
## Create the list of includes as cx_freeze likes
include_files = []
for dll in missing_dll:
include_files.append((os.path.join(include_dll_path, dll), dll))
## Let's add glade folder and files
include_files.append((glade_folder, glade_folder))
## Let's add gtk libraries folders and files
for lib in gtk_libs:
include_files.append((os.path.join(include_dll_path, lib), lib))
base = None
## Lets not open the console while running the app
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable("CodeGenerator.py",
base=base
)
]
buildOptions = dict(
compressed = False,
includes = ["gi", "csv", "datetime",],
packages = ["gi"],
include_files = include_files
)
setup(
name = "Code Generator",
author = "Ed den Beer",
version = "1.0",
description = "Generating copy instructions for RsLogix5000 out of a list with tags in a CSV file",
options = dict(build_exe = buildOptions),
executables = executables
)
我的问题解决了。
如果找到名为 ListDlls.exe 的实用程序,则寻找答案。
在此 link 中解释了如何使用它:
https://bitbucket.org/anthony_tuininga/cx_freeze/issue/92/pygi-and-cx_freeze-error
我在使用 cx_freeze 时遇到了一些小问题,希望你们中的一位能帮助我。我已经通过这个很棒的论坛进行了搜索,但找不到答案。 我之前在 python 3.3 和 ktinker 中使用过 cx_freeze,并且工作完美。 现在我用更复杂的 gui 制作了一个小工具并尝试了 Glade。 使用 Glade 构建图形用户界面非常适合我,在 Linux 和 Windows 7 上,我制作的应用程序运行良好(在 python 解释器中)。
当我 运行 python setup.py bdist_msi
我没有看到任何错误但是当我尝试 运行 windows 中的 exe 时我得到这个错误 window:
(我不能 post 图片喷射)
最后 4 行是:
_load_backward_compatible
File "ExtentionLoader_gi_gi.py", line 22, in <module
File "ExtentionLoader_gi_gi.py", line 14, in_bootstrap_
ImportError: DLL load failed: The specified module could not be found
我不使用任何插件和外来进口,所以我必须加载的 dll 只是 Gobject 的 dll。我根据本论坛上的示例制作的安装文件。对于我的 ktinker 应用程序,我不必导入任何 dll。
最后一个问题:是否有某个地方的 dll 列表告诉我必须添加哪些 dll?
我的 setup.py 有问题吗?
代码没什么特别的,但如果你想检查它:https://github.com/EddenBeer/CodeGenerator
Python中的进口:
import csv import sys import datetime
from gi.repository import Gtk
安装于 Windows 7:
Python-3.4.2
cx_Freeze-4.3.3.win32-py3.4
pygi-aio-3.14.0_rev6-setup
Setup.py:
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, "gnome")
## 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-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',
'libgnutls-26.dll',
'libgcrypt-11.dll',
'libp11-kit-0.dll'
]
## We also need to add the glade folder, cx_freeze will walk
## into it and copy all the necessary files
glade_folder = 'glade'
## We need to add all the libraries too (for themes, etc..)
gtk_libs = ['etc', 'lib', 'share']
## Create the list of includes as cx_freeze likes
include_files = []
for dll in missing_dll:
include_files.append((os.path.join(include_dll_path, dll), dll))
## Let's add glade folder and files
include_files.append((glade_folder, glade_folder))
## Let's add gtk libraries folders and files
for lib in gtk_libs:
include_files.append((os.path.join(include_dll_path, lib), lib))
base = None
## Lets not open the console while running the app
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable("CodeGenerator.py",
base=base
)
]
buildOptions = dict(
compressed = False,
includes = ["gi", "csv", "datetime",],
packages = ["gi"],
include_files = include_files
)
setup(
name = "Code Generator",
author = "Ed den Beer",
version = "1.0",
description = "Generating copy instructions for RsLogix5000 out of a list with tags in a CSV file",
options = dict(build_exe = buildOptions),
executables = executables
)
我的问题解决了。 如果找到名为 ListDlls.exe 的实用程序,则寻找答案。 在此 link 中解释了如何使用它: https://bitbucket.org/anthony_tuininga/cx_freeze/issue/92/pygi-and-cx_freeze-error