将 python 程序转换为可执行文件时遇到问题

发布于 2025-01-10 09:23:29 字数 311 浏览 3 评论 0原文

我创建了一个存储在桌面上的简单 python 程序。使用 CMD,我将当前目录设置为文件所在的目录。

然后我使用 pyinstaller MAIN.py (其中 MAIN 是文件名)

在此处输入图像描述

但仍然显示找不到脚本。

编辑:问题在于名称。 'main' 是 python 的保留关键字/内置类。

I created a simple python program stored on desktop. Using CMD, I set the current directory as the one where the file is located.

Then i used pyinstaller MAIN.py (where MAIN is the filename)

enter image description here

But it's still showing that script is not found.

EDIT: The issue was with the name. 'main' is a reserved keyword/ inbuilt class for python.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筱果果 2025-01-17 09:23:29

难道你保存的 MAIN.py 文件在 MAIN 后面有一个空格?至少在屏幕截图上看起来是这样的:)。所以[MAIN(space).py]。

could it be that you saved your MAIN.py file with a space after the MAIN? It looks at least on the screenshot like this :). So [MAIN(space).py].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文