使用PyInstaller

时间:2018-04-26 19:43:40

标签: python macos kivy pyinstaller

打开DMG并将mom.app拖到应用程序后,应用程序会短暂启动并立即关闭(崩溃)。

但是,如果我打开包并导航到目录     使用所有打包的内容并双击创建的二进制妈妈,然后它正确启动游戏:       右键单击|显示包装内容|

What EXACTLY is the working directory of an installed app in /Applications/<your app>  is it /Applications/<your app> ? 
I tried setting to /Applications/<your app>/Contents and that did not seem to work.  May I do not have a pathing problem, 
but I just get a momentary flash and then it closes down.

下面是用于PyInstaller的spec文件,但我认为这个问题不依赖于spec文件中的内容:

# -*- mode: python -*-

#                *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],
# from kivy.deps import sdl2, glew

# 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)

0 个答案:

没有答案