做拆分pdf的时候,打包成exe,但是换台电脑,一直报如下错误,为什么TkinterDnD.py会没有贝打包进去,搜了下没找到解决方法。求解
Traceback (most recent call last):
File "tkinterdnd2\TkinterDnD.py", line 53, in _require
_tkinter.TclError: can't find package tkdnd
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "拆分pdf.py", line 91, in <module>
File "tkinterdnd2\TkinterDnD.py", line 285, in init
File "tkinterdnd2\TkinterDnD.py", line 55, in _require
RuntimeError: Unable to load tkdnd library.
求解
如果你用的是
pyinstaller
,那么按照 tkinterdnd2的官方文档,你需要添加hook: https://github.com/pmgagne/tkinterdnd2/blob/master/README.md#pyinstaller而这个 hook 就存在于源码仓库中: https://github.com/pmgagne/tkinterdnd2/blob/master/hook-tkinterdnd2.py
正好前两天也有同样的需求,所以知道这个