使用 py2exe 创建了一个 .exe,但是当我从“dist”复制粘贴时文件夹到桌面,无法正常运行
我对 Python 和 py2exe 还很陌生。我已经从 py2exe 创建了一个可执行文件,但是当我尝试从创建它的“dist”文件夹中复制单个 .executable 并将其粘贴到其他位置(假设我的桌面)时,当我在移动后打开可执行文件时从它打开的文件夹中快速消失(它是一个控制台应用程序)。该程序有多个输入/输出,因此不应出现这种情况。如果我将其保留为原始的“dist”文件夹,它的功能会正常。
我有什么遗漏的吗?如果我只想获取单个文件 (.exe) 并将其放在另一台计算机(未安装 Python)上并使其正确运行,我需要做什么?
提前致谢!
I'm still new to Python and py2exe. I've created an executable from py2exe, but when I try to copy the single .executable from the "dist" folder it was created in, and paste it else where (let's say my desktop), When I open the executable after it's moved from the folder it opens quickly disappears (it's a console application). The program has several input/output, so this should not be the case. Its DOES function correctly if I leave it the original "dist" folder.
Is there something I'm missing? What do I need to do if I just want to take the single file (.exe) and put it on a different machine (that doesn't have Python installed) and get it to run correctly?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 dist 目录中有一组运行 exe 文件所需的 .dll 文件。
In the dist directory is there a set of .dll files needed to run the exe file.
正如其他人所说,您需要 .dll 文件来运行该程序。但是,如果您将程序保留在 dist 文件夹中(或创建 dist 的副本)并创建快捷方式,则它可以工作。您可以将快捷方式移动到任何您喜欢的位置并且它会起作用,因为文件本身仍然位于包含 .dll 的文件夹中。
As others said, you need the .dll files to run the program. It works however if you leave the program in the dist folder (or create a copy of dist) and create a shortcut. You can move the shortcut wherever you like and it will work, since the file itself is still in the folder with the .dlls.
将您的 dist 文件夹放入系统搜索路径中,它应该可以正常工作。
这在过去也发生在我身上。
Put your dist folder into the system search path, and it should work fine.
This happened to me also in times past.