我安装的应用在尝试使用此错误播放声音时崩溃:
File "kivy/lib/gstplayer/_gstplayer.pyx", line 233, in kivy.lib.gstplayer._gstplayer.GstPlayer.load
kivy.lib.gstplayer._gstplayer.GstPlayerException: Unable to create a playbin
尽管遵循官方包装文档上的详细说明:
https://kivy.org/docs/guide/packaging-osx.html
是否有其他人成功创建了Kivy + PyInstaller +声音+ OSX?
我似乎无法在spec文件中导入sdl2(下面):
官方包装文档中的这一行对我不起作用:
################################################## ################ 100.0%brew重新安装--with-python --build-bottle https://github.com/cbenhagen/homebrew/raw/patch-3/Library/Formula/gst-python.rb
Error: undefined method `revision' for #<BottleSpecification:0x00000101dbf1a8>
Please report this bug:
https://docs.brew.sh/Troubleshooting
/Users/erikbethke/Library/Caches/Homebrew/Formula/gst-python.rb:8:in `block in <class:GstPython>'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:101:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/software_spec.rb:101:in `bottle'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2086:in `bottle'
/Users/erikbethke/Library/Caches/Homebrew/Formula/gst-python.rb:7:in `<class:GstPython>'
/Users/erikbethke/Library/Caches/Homebrew/Formula/gst-python.rb:1:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:26:in `module_eval'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:26:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:46:in `load_formula_from_path'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:101:in `load_file'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:174:in `load_file'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:92:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:88:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:280:in `factory'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:57:in `block in resolved_formulae'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:55:in `map'
/usr/local/Homebrew/Library/Homebrew/extend/ARGV.rb:55:in `resolved_formulae'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:13:in `reinstall'
/usr/local/Homebrew/Library/Homebrew/brew.rb:101:in `<main>'
下面是我的spec文件,请注意我必须注释掉sdl2导入行,否则我会收到以下导入错误:
# -*- mode: python -*-
# *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],
# from kivy.deps import sdl2, glew, gstreamer
from kivy.core.audio import SoundLoader
block_cipher = None
from kivy.tools.packaging.pyinstaller_hooks import get_deps_all, hookspath, runtime_hooks
from kivy.tools.packaging.pyinstaller_hooks import get_hooks
added_files = [
( '/Users/erikbethke/Desktop/SMS/MarsSim/assets', 'assets' ),
( '/Users/erikbethke/Desktop/SMS/MarsSim/simObject/resourceBar.kv', 'simObject' ),
( '/Users/erikbethke/Desktop/SMS/MarsSim/views/fileOperations.kv', 'views' ),
( '/Users/erikbethke/Desktop/SMS/MarsSim/views/marsDialog.kv', 'views' ),
]
a = Analysis(['/Users/erikbethke/Desktop/SMS/MarsSim/marsMain.py'],
pathex=['/Users/erikbethke/Desktop/SMS/dist'],
binaries=[],
datas=added_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='mom',
debug=False,
strip=False,
icon='/Users/erikbethke/Desktop/SMS/MarsSim/logo.icns',
upx=True,
console=True )
coll = COLLECT(exe, Tree('/Users/erikbethke/Desktop/SMS/MarsSim/assets'),
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='mom')
app = BUNDLE(coll,
name='mom.app',
icon='/Users/erikbethke/Desktop/SMS/MarsSim/logo.icns',
bundle_identifier=None)
导入错误
175 INFO: PyInstaller: 3.3.1
175 INFO: Python: 3.6.5
180 INFO: Platform: Darwin-15.6.0-x86_64-i386-64bit
182 INFO: UPX is not available.
183 INFO: Removing temporary files and cleaning cache in /Users/erikbethke/Library/Application Support/pyinstaller
[INFO ] [Logger ] Record log in /Users/erikbethke/.kivy/logs/kivy_18-04-26_87.txt
206 INFO: [Logger ] Record log in /Users/erikbethke/.kivy/logs/kivy_18-04-26_87.txt
[INFO ] [Kivy ] v1.10.1.dev0, git-Unknown, 20180424
206 INFO: [Kivy ] v1.10.1.dev0, git-Unknown, 20180424
[INFO ] [Python ] v3.6.5 (default, Mar 30 2018, 06:41:49)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
206 INFO: [Python ] v3.6.5 (default, Mar 30 2018, 06:41:49)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
Traceback (most recent call last):
207 WARNING: stderr: Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 11, in <module>
207 WARNING: stderr: File "/usr/local/bin/pyinstaller", line 11, in <module>
sys.exit(run())
207 WARNING: stderr: sys.exit(run())
File "/usr/local/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
207 WARNING: stderr: File "/usr/local/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
207 WARNING: stderr: run_build(pyi_config, spec_file, **vars(args))
File "/usr/local/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
208 WARNING: stderr: File "/usr/local/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
208 WARNING: stderr: PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/usr/local/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in main
208 WARNING: stderr: File "/usr/local/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
208 WARNING: stderr: build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/usr/local/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 737, in build
209 WARNING: stderr: File "/usr/local/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 737, in build
exec(text, spec_namespace)
209 WARNING: stderr: exec(text, spec_namespace)
File "<string>", line 6, in <module>
209 WARNING: stderr: File "<string>", line 6, in <module>
ImportError: cannot import name 'sdl2'
209 WARNING: stderr: ImportError: cannot import name 'sdl2'