【问题标题】:I'm using PyInstaller to turn a .py file into a .exe file, but I'm having difficulty?我正在使用 PyInstaller 将 .py 文件转换为 .exe 文件,但我遇到了困难?
【发布时间】:2012-04-08 13:33:17
【问题描述】:

我已将其更改为 .spec 文件,之后它会告诉我运行 build.py。我这样做了,但它出现了 Build.py:错误:只需要一个 .spec 文件,然后什么都不做。我做错了什么?

【问题讨论】:

    标签: python cmd exe pyinstaller


    【解决方案1】:

    我建议您使用标准的 PyInstaller 脚本 pyinstaller.py,它将所有其他脚本组合到一个界面中。

    只需输入:

    python pyinstaller.py your_script.py

    PyInstaller 会创建一个 Build 和 Dist 文件夹,并将你的 exe 放在 Dist 文件夹中。

    【讨论】:

      【解决方案2】:
      1. 将您的脚本放在一个新文件夹中。
      2. 运行第一个脚本(configure.py 如果没记错的话)
      3. 运行第二个脚本(make.py yourfolder\yourscript.py 再次从内存中)
      4. 运行最后一个脚本(build.py yourfolder\yourscript.spec)

      你现在应该有一个 exe。 祝你好运。

      【讨论】:

        【解决方案3】:

        以下是我用来制作exe的。

        使用 python ../pysinstaller-1.5/Configure.py

        python ../pyinstaller-1.5/MakeSpec.py -F --noconsole -n name-of-the-app path-to-your main-.py-file

        python ../pyinstaller-1.5/Build.py path-to-name-of-the-app.spec-file-produced

        注意:您应该只需要在全新安装后运行一次配置。

        【讨论】:

          【解决方案4】:

          如果您像我一样在路径变量中设置了 pyinstaller,那么您所要做的就是:

          pyinstaller -F

          它会自动生成其他所有内容。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2021-05-19
            • 1970-01-01
            • 1970-01-01
            • 2021-06-14
            • 2023-04-06
            • 1970-01-01
            • 1970-01-01
            • 2020-12-05
            相关资源
            最近更新 更多