什么是“可执行表单”?
我对编程相当陌生,但我想知道“可执行形式”是什么意思?如何将 Python 文件转换为可执行形式。
I'm fairly new to programming but I was wondering what 'executable form' meant & how to convert a Python file into an executable form.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜想无论是谁写的都意味着在文件上设置可执行位。要在大多数 UNIX 平台上执行此操作,您需要进入某种 shell 并运行以下命令:(
请注意,实际上并不需要完整路径 — 您也可以使用相对路径)
如果您已完成此操作并且该文件以适当的 hashbang 开头,例如:
然后您应该能够非常轻松地运行该脚本:(
假设您的工作目录与
file.py
所在的目录相同)I'd guess that whoever wrote that meant to set the executable bit on the file. To do that on most UNIX platforms, you'll need to go into some kind of shell and run this:
(note that the full path is not actually required — you can use a relative path, too)
If you've done that and the file starts with an appropriate hashbang like:
Then you should be able to run the script very easily:
(assuming your working directory is the same as the directory in which
file.py
is located)在Windows平台上,“可执行形式”是指PE文件,更具体地说是“.exe”文件。
也许您可以使用 py2exe 将 py 脚本转换为 exe 文件。
On windows platform, "executable form" means PE files, more specifically, ".exe" files.
Maybe you can use py2exe to convert a py script to an exe file.