Python 使用 pyinstaller 创建的可执行文件将不再 运行 带有依赖包

Python executable created using pyinstaller will no longer run with dependant packages

我有一个用 python 编写的程序导出到 raspberry pi 到 运行。我测试了 raspberry pi 中的 .py 文件以验证它是否有效,然后使用 pyinstaller 将 .py 文件的 --onefile 副本制作为可执行文件。当我尝试 运行 可执行文件时,我收到一条错误消息,指出没有名为 tkinter 的模块。

ImportError: no module named tkinter

我在 x86 计算机上使用 pyinstaller 并尝试移植到 raspi 之前遇到了问题,但我在 raspi 上编译并避免了这个问题,现在看来我并没有像预期的那样冻结所有包到。为了制作可执行文件,我 运行 以下内容:

pyinstaller --onefile bar_3axis.py

如有任何帮助,我们将不胜感激。我需要 post 从 pyinstaller 命令中完成读取吗?

好吧,我想让每个人都知道这是因为我的程序是用 python3 软件包编写并受其支持的,我下载并使用了使用 python 2.7 制作可执行文件的 pyinstaller。我卸载了 pyinstaller 并使用 pip3 重新下载,它非常有效。