- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
请阅读所有这篇文章并帮助我。
我想用 pyinstaller 创建 --onefile
可执行文件。
我在开发方面有这些:
以及部署端 (VirtualBox) 中的这些(作为干净的 VM):
这是我要构建的简单 python 程序:
#main.py
import sys
from PyQt5.QtWidgets import QApplication, QPushButton
app = QApplication(sys.argv)
win = QPushButton("Hello World!")
win.show()
sys.exit(app.exec_())
#------------------------------------------------
好的,当我将其构建为 --onedir
(pyinstaller main.py
) 时,它在开发端和部署端都运行良好。
当我将其构建为 --onefile
(pyinstaller -F main.py
) 时,它在开发端运行良好,但在部署端不起作用。
并给出这个错误:
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen, windows.
Reinstalling the application may fix this problem.
是我的错还是这栋楼的问题是什么?
就此错误而言,它无法在临时文件夹的 _MEIxxxxx
文件夹中找到 qt5_plugins
文件夹。
或者,您认为问题出在 sys
模块?如果是,我该怎么办?
提前感谢回复
更新:
我应该说我在构建时有这个警告和错误:
1024 WARNING: No such file C:\Python27\msvcp90.dll 1024 WARNING: Assembly incomplete 1026 ERROR: Assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
更新2:
我将 msvcp90.dll
、msvcm90.dll
手动添加到 c:\Python27
,此警告和错误已解决。
更新 3:
qt.conf:
[Paths]
Plugins = qt5_plugins
主要规范:
# -*- mode: python -*-
a = Analysis(['main.py'],
pathex=['D:\\hello2'],
hiddenimports=['sip', "PyQt5.QtCore", "PyQt5.QtGui", "PyQt5.QtWidgets"],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
plugins = [("qt5_plugins/platforms/qwindows.dll",
"C:\\Qt\\Qt5.2.1\\5.2.1\\msvc2012_64\\plugins\\platforms\\qwindows.dll", "BINARY")]
data = [
("qt.conf", "qt.conf", "DATA")
]
exe = EXE(
pyz,
a.scripts,
a.binaries + plugins,
a.zipfiles,
a.datas + data,
name='main.exe',
debug=False,
strip=None,
upx=True,
console=True
)
qt5_plugins
是用 pyinstaller
自动创建的,有平台插件。我认为它不需要手动添加为 extralib。
最佳答案
我刚刚第一次尝试使用 pyinstaller 并收到了丢失的“windows”消息。
在查看了许多“解决方案”并尝试了各种方法后,我终于通过将 C:\Python34\Lib\site-packages\PyQt4\plugins\platforms 中的 qwindows.dll 放到应用程序目录 (dist) 中解决了这个问题qt4_plugins\平台(我手动创建了platforms目录,pyinstaller创建了qt4_plugins目录)
虽然不如创建 qt.conf 文件那么优雅,但它使应用程序正常运行。
我应该补充一点,我正在使用 Windows 7、python 3.4 和 PyQt4。
关于python - bundle (只是--onefile),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23446124/
我有一个应用程序,我想将其打包到一个文件中,但在使用 --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
我是一名优秀的程序员,十分优秀!