我想将我的应用程序提供给某个人,但它在他的计算机上无法运行 Python pyinstaller

I want to give my app to some one but it does not work on his computer Python pyinstaller

我已经构建了一个商店管理系统,并使用像 "pyinstaler -F admin1.py" 这样的 pyinstaller 编译了它。

当我 运行 我的计算机上的应用程序 运行 完美时,它给了我一个构建文件和一个 dist 文件。我已将 dist 文件夹复制到另一台计算机,但它没有 运行,所以我需要将构建文件复制到或者是他们将文件复制到其他系统的另一种方式。我只使用 tkinter、os 模块和 datetime 模块,但我在不同的模数中使用了我的程序。

我无法发表评论,因为我没有足够的信誉,但是您尝试 运行 此批处理文件的另一台计算机是否有任何错误消息?

根据 pyinstaller 文档的 this section,您需要将可执行文件的接收者发送到 "build" 目录。这是因为构建包含脚本中的所有依赖项。引用关于在一个文件夹中导入的部分(注意: 别担心,我看到了你设置的 onefile 选项。这只是文档提到你的构建目录的部分重新查询):

Another advantage of a one-folder bundle is that when you change your code, as long as it imports exactly the same set of dependencies, you could send out only the updated myscript executable. That is typically much smaller than the entire folder. (If you change the script so that it imports more or different dependencies, or if the dependencies are upgraded, you must redistribute the whole bundle.)

我认为 -F 仍然会创建一个 /build 目录(因此您仍然可以跟踪依赖项)。我会分享它,因为它也会与一个文件夹选项共享。 Pyinstaller 知道寻找 Tkinter(也在上面链接的文档中),所以至少你不必担心那部分。 当你使用 onefile 时,/dist 目录应该是空的,或者至少在我创建可执行文件时它是空的。

尝试使用一个文件夹的方法,然后将该文件夹发送到您需要的任何计算机。让我知道这是否有帮助。

TLDR; 是的,分享构建文件。它包含您所有的依赖项。 dist 文件不应包含“-F”选项的任何内容。