关键字:
python pyinstaller 打包tkinter,mkdirs创建tk,tcl路径失败。
环境:
python3.6x,
mac os 10.10.5,
PyInstaller (3.3.1)
1.修改Python路径下PyInstaller/hooks/hook-_tkinter.py。修改改文件下的方法_collect_tcl_tk_files(hook_api)。改为:
tcltree = Tree(
tcl_root, prefix='tcl2', excludes=['demos', '*.lib', 'tclConfig.sh'])
tktree = Tree(
tk_root, prefix='tk2', excludes=['demos', '*.lib', 'tkConfig.sh'])
2.PyInstaller/loader/rthooks/pyi_rth__tkinter.py。修改为
tcldir = os.path.join(sys._MEIPASS, 'tcl2')
tkdir = os.path.join(sys._MEIPASS, 'tk2')
3.名字对应的要保持一致