【发布时间】:2018-06-29 06:55:49
【问题描述】:
我在获取使用 pyinstaller 制作的 .app 包以在其他人的 Mac 上运行时遇到了一些问题。
运行 macOS 10.13.2 和 Python 3.6 的两台计算机。
在我的 Mac 上运行与运行 .py 文件时一样。
在对方的 Mac 上,图标会在他的托盘中弹出片刻,然后弹跳一两次,然后消失。在尝试打开应用程序时保持打开状态时,它永远不会出现在强制退出窗口中。
这是规范文件:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['Shadowmaster.py'],
pathex=['/Users/jacob/Dropbox/Games/Shadowrun/Python/Shadowmaster'],
binaries=[],
datas=[],
hiddenimports=['sys', 'webbrowser', 'random', 'decimal', 'collections', 'tkinter', 'tracback'],
hookspath=[],
runtime_hooks=[],
excludes=[],
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='Shadowmaster',
debug=False,
strip=False,
upx=True,
console=False , icon='icon.icns')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='Shadowmaster')
app = BUNDLE(coll,
name='Shadowmaster.app',
icon='icon.icns',
bundle_identifier=None,
info_plist={'CFBundleDisplayName': 'Shadowmaster',
'CFBundleName': 'Shadowmaster',
'CFBundleIdentifier': 'Shadowmaster',
'CFBundleExecutable': 'MacOS/Shadowmaster',
'CFBundleIconFile': 'icon.icns',
'CFBundleInfoDictionaryVersion': '6.0',
'CFBundlePackageType': 'APPL',
'CFBundleShortVersionString': '0.0.6',
'LSBackgroundOnly': '0',
'NSHighResolutionCapable': 'True'})
该程序有数千行,但这里是导入,我怀疑这可能是原因:
import sys
from webbrowser import open_new as open_browser
from random import SystemRandom
from time import sleep
import decimal
from collections import OrderedDict
import tkinter as tk
import tkinter.ttk as ttk
import traceback
import tkinter.messagebox
有什么建议吗?
【问题讨论】:
标签: python macos tkinter python-3.6 pyinstaller