Python Gstreamer 1.0冻结到一个独立的应用程序中-可能吗?
我一直在努力让Python GStreamer 1.0绑定在它自己的可执行文件中独立运行。事实证明,它比我预想的要复杂得多,而且几乎没有相关的文档。因此,我将详细介绍对我有效的方法,希望人们能够在这种方法上添加可以改进的内容 我第一次尝试用PyInstaller编译它,希望我能把它简化为一个exe文件,但是经过几天的努力,我发现GStreamer 1.0运行的GTK+3使用了命名空间包,目前只有cx_Freeze支持。(最终也使用PyInstaller 3.0) 这是一个大问题,但为了让它在一个独立的程序中工作,还需要进行其他修改 运行:Python Gstreamer 1.0冻结到一个独立的应用程序中-可能吗?,python,gstreamer,gtk3,cx-freeze,Python,Gstreamer,Gtk3,Cx Freeze,我一直在努力让Python GStreamer 1.0绑定在它自己的可执行文件中独立运行。事实证明,它比我预想的要复杂得多,而且几乎没有相关的文档。因此,我将详细介绍对我有效的方法,希望人们能够在这种方法上添加可以改进的内容 我第一次尝试用PyInstaller编译它,希望我能把它简化为一个exe文件,但是经过几天的努力,我发现GStreamer 1.0运行的GTK+3使用了命名空间包,目前只有cx_Freeze支持。(最终也使用PyInstaller 3.0) 这是一个大问题,但为了让它在一个
- gstreamer-1.0-devel-x86-1.2.3
- pygi-aio-3.10.2-win32_rev16(在安装程序中指定时创建gnome文件夹并添加gstreamer dll)
################################
######### CX-FREEZE ############
################################
import os, site, sys
from cx_Freeze import setup, Executable
include_files = []
import site
include_dll_path = site.getsitepackages()[-1]
###### FINDING Gstreamer FILES TO BE INCLUDED ######
## Collect the list of missing dll when cx_freeze builds the app
gnomePath = os.path.join(include_dll_path, "gnome")
for fileName in os.listdir(gnomePath):
fullname = os.path.join(gnomePath, fileName)
if os.path.isfile(fullname):
include_files.append((fullname, fileName))
## We need to add all the libraries too (for themes, etc..)
gtk_libs = ['lib']
for lib in gtk_libs:
include_files.append((os.path.join(include_dll_path, "gnome", lib), lib))
base = None
## Lets not open the console while running the app
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable(
"test.py",
#base=base,
base="Console",
targetName = 'test.exe',
shortcutName="test Player",
shortcutDir="DesktopFolder",
)
]
buildOptions = dict(
compressed = False,
includes = ['gi._glib'],
excludes = [],
packages = [],
silent=False,
include_files = include_files,
icon = 'test.ico',
namespace_packages = 'gi.overrides',
copy_dependent_files = True
)
setup(
name = "Test",
author = "Simon Warwick",
version = "0.0.0",
description = "Test Player",
options = dict(build_exe = buildOptions),
executables = executables
)
我遇到的其他一些问题:
这是我目前所能记得的,但如果我了解更多,我会更新列表。Heh,是的,我真的不明白为什么或者背景是什么,但所有GStreamer dll和内容都放在python27/lib/site packages/gnome/中的文件夹。。。我试图直接从gstreamer安装路径中提取该内容,但我遇到了模糊不清的丢失模块错误,我无法费心去弄清楚到底发生了什么。也许有人有更有效的方法。。?