Answer a question

I'm "compiling" a program using PyInstaller using a .spec file. I'm using the .spec file because I need to include an extra file in the program. When I try to do PyInstaller --onefile Prog.spec, it still makes a folder in dist with all the files separate instead of making a single file as I'd expect. If I do PyInstaller --onefile Prog.py then it does make a single .exe file in dist, which is what I want. Is there something special I need to do when using a .spec file?

Answers

Use pyi-makespec --onefile yourprogram.py to generate a sample spec file for onefile mode.

https://pyinstaller.readthedocs.io/en/stable/man/pyi-makespec.html


There is no COLLECT call, and the EXE call is different. Example:

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='main',
          debug=False,
          strip=False,
          upx=True,
          runtime_tmpdir=None,
          console=True )
Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐