前言
- 用python写了个自动化工具,为了方便没有python环境的同事使用,故准备将其打包成exe。
- 由于本人使用的是虚拟环境,原来在默认的虚拟环境下没有pyinstaller,且写代码的电脑没有网络,因此只能本地安装包。
安装
- 之前的项目是python2.7,安装pyinstaller时,需要安装各种依赖库,如下:
- altgraph
- dis3
- future
- macholib
- pefile
- pywin32-ctypes - 其中dis3和future都是因为python2的缘故,需要导入部分python3的特征。而通过阅读pyinstaller文档得知,pyinstaller3.4已经完全停止对pywin32的依赖,转而依赖pywin32-ctype。
问题
成功打包后,文件报错
Traceback (most recent call last): File “PyInstaller/loader/rthooks/pyi_rth__tkinter.py”, line 28, in <module> FileNotFoundError: Tcl data directory “/var/folders/nl/2wxh3z313l129zpzq2f8ww5m0000gn/T/_MEILUmJRc/tcl” not found. [2195] Failed to execute script pyi_rth__tkinter
一开始以为是虚拟环境的问题,排查了好久。
最后通过查阅各种外网得知,原因如下:
The Error Message basically refers to a file that cannot be found. In most cases, this file may not be n


1990

被折叠的 条评论
为什么被折叠?



