TkinterDnD.py 在打包 exe 后缺失,导致无法加载 tkdnd 库,如何解决?-灵析社区

刘一抗二二

做拆分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 File "tkinterdnd2\TkinterDnD.py", line 285, in **init** File "tkinterdnd2\TkinterDnD.py", line 55, in _require RuntimeError: Unable to load tkdnd library. ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20240917/7a6398d7cdd8997ad8615139efc8ef4b.png) 求解

阅读量:211

点赞量:0

问AI
biubiuuuuu
这个报错信息是因为在打包的时候没有将依赖一起打包。 题主需要根据打包时使用的工具,查阅一下如何打包依赖库。 推荐题主使用 pyinstaller 就行打包,其默认会添加第三方包依赖。也可以通过配置添加导入包外的依赖。