- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 PyInstaller 使用 .spec 文件“编译”一个程序。我正在使用 .spec 文件,因为我需要在程序中包含一个额外的文件。当我尝试执行 PyInstaller --onefile Prog.spec
时,它仍然在 dist
中创建一个文件夹,所有文件都分开,而不是像我期望的那样创建一个文件.如果我执行 PyInstaller --onefile Prog.py
,那么它会在 dist
中生成一个 .exe 文件,这正是我想要的。使用 .spec 文件时,我需要做什么特别的事情吗?
最佳答案
使用 pyi-makespec --onefile yourprogram.py
为 onefile 模式生成示例规范文件。
https://pyinstaller.readthedocs.io/en/stable/man/pyi-makespec.html
没有COLLECT调用,EXE调用不同。示例:
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='main',
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True )
关于python - 在 PyInstaller 中使用 --onefile 和 .spec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47143315/
我有一个应用程序,我想将其打包到一个文件中,但在使用 --onefile 选项(包括 html、js 和 css 文件)时遇到了问题。该过程在运行 --onedir 时运行良好(当然是在将各个数据文件
请阅读所有这篇文章并帮助我。 我想用 pyinstaller 创建 --onefile 可执行文件。 我在开发方面有这些: Windows 8.1 x64 Qt 5.2.1 python 27 PyQ
我用“pyinstaller --onefile myapp.py”打包了一个 python 应用程序,它创建了一个可执行文件,并且该应用程序运行良好。现在我希望能够从系统中导入一个模块(如果存在),
我知道我不是第一个提问的,但论坛上的其他答案帮不了我,所以我来提问。我有一个只有导入的简短(181 行)python 脚本 import numpy as np import matplotlib.p
我正在尝试使用 PyInstaller 构建一个包含图像和图标的单文件 EXE。我一辈子都无法让它与 --onefile 一起使用。 如果我这样做 --onedir 它工作得很好。当我使用 --one
我有一个有效的 Python 3 脚本 inventoryScraper.py,我正试图将其制作成一个我可以分发的 1 文件可执行文件。我一直在将 Pyinstaller 3 与 Python 3 一
我正在尝试将图像添加到 Pyinstaller 生成的一个文件中。我读过很多这样的问题/论坛 one那one但仍然无法正常工作。 我知道对于一个文件操作,PyinSTLler 会生成一个可以通过 sy
我正在尝试将包含图像的文件夹嵌入到生成的(使用 PyInstaller)可执行文件中。但这对我不起作用。即使只有一张简单的图片! 我的 main.spec 文件中的 datas 变量如下所示: dat
我正在尝试使用 pyinstaller 打包 cli 应用程序(当前适用于 macos)。我阅读 pyinstaller 文档的最初印象是,当使用 --onefile 选项时,我将能够将所有必需的文件
我正在尝试使用 Pyinstaller 构建单文件 EXE 文件,它包含 Sqlite 数据库文件,它不能与 --onefile 一起使用,但在正常情况下意味着(许多文件)它工作 100%。 我正在做
我正在尝试使用 PyInstaller 2.0 将我的 py 脚本捆绑为 .exe。我可以捆绑脚本,但在我的脚本中,我需要打开一个应该捆绑在 exe 中的文件(因此它是可移植的)。我在执行此操作时遇到
我听到 3 年前的问题,显然有无穷大的解决方案。我想找到这个无限集合中的一个。 问题: 编写程序(只有一个文件示例“selfsource.c”)在 stdout 上打印自己的源代码并退出。 所有技术都
我有一个应用程序,其中有两个可执行文件:Flask-SocketIO-Server 和 CefPython 浏览器。我将这两个可执行文件与 PyInstaller 捆绑在一起。带有 --onefile
我创建了一个 exe 文件,它在某些 Windows 机器上运行良好,但在其他机器上运行失败。 我还找不到失败的原因。 重要数据: x64 可执行程序 Windows 7 python 3.5.1 p
我正在使用 PyInstaller 使用 .spec 文件“编译”一个程序。我正在使用 .spec 文件,因为我需要在程序中包含一个额外的文件。当我尝试执行 PyInstaller --onefile
我已经从 python tkinter GUI 成功创建了一个包含图像的 EXE 文件。请参阅以下代码: lblLogo=Label(main) lblLogo.grid(row=3,column=1
我正在尝试使用 PyInstaller 1.5 编译 PyQt 程序。当我使用 --onedir(默认)时,以下两个程序对我来说都很好,但这会创建相当大的程序。我想使用 --onefile 选项,但是
我已经使用 Pyinstaller 创建了一个 exe 文件。 pyinstaller.exe --onefile --icon='Loco.ico program.py 在该程序中,我在绘图中包含了
我有一个小脚本,它使用 tableau rest api 从 tableau View 下载数据。由于脚本在公司环境中运行,因此我必须使用 SSL。那就是 python-certifi-win32 的
我正在使用 PyInstaller 将我的应用程序捆绑到一个 .exe 文件中。 问题是它可以使用 --onedir 选项正常工作,但是使用 --onefile 构建时找不到模块。 --onedir
我是一名优秀的程序员,十分优秀!