pip install pyinstaller
pyinstaller hogehoge.spec --clean --onefile
で実行するとこのエラー
File "PyInstaller/loader/rthooks/pyi_rth__tkinter.py", line 30, in <module>
FileNotFoundError: Tcl data directory "/var/folders/j7/5l7s1ly92cndg76ghdw1gyx40000gn/T/_MEIHPuWkm/tcl" not found.
[29577] Failed to execute script pyi_rth__tkinter
specファイルにTclを追加すると解決できる
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['/Users/user/PycharmProjects/onehundred'],
binaries=[('/System/Library/Frameworks/Tk.framework/Tk', 'tk'), ('/System/Library/Frameworks/Tcl.framework/Tcl', 'tcl')],
datas=[],
hiddenimports=['PySide2.QtXml', 'PyMySQL'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
Tree('ui_files',prefix='ui_files'), # 追加
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='onehundred',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
app = BUNDLE(exe,
name='onehundred.app',
info_plist={ 'NSHighResolutionCapable': 'True'}, # 追加
icon=None,
bundle_identifier=None)
binariesに、Tclを追加すると上手くいきました。
引数ですが、binaries=["開発時のパス","解凍時のパス"]