我正在开发一个显示folium地图的web应用程序。web应用程序有3个选项卡,每个选项卡都添加了一个QtWebEngineView小部件。
我正试图为我的web应用程序创建一个独立的.exe文件。因此,我使用Pyinstaller将我的项目转换为一个.exe文件。我已经对我的规范文件做了一些修改,以解决以前的一个问题(修复)。规范文件就是这样的。
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['D:\\Bus_Stop_Finder'],
binaries=[],
datas=[('input\\stops.txt', 'input'),
('input\\Suggestions.xlsx', 'input'),
(".\\venv\\Lib\\site-packages\\branca\\*.json","branca"),
(".\\venv\\Lib\\site-packages\\branca\\templates","templates"),
(".\\venv\\Lib\\site-packages\\folium\\templates","templates"),
],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='main')
在运行Pyinstaller mainspec
时,会创建dist文件夹和main.exe文件,但一旦运行main.exe文件,就会得到以下错误:
Could not find QtWebEngineProcess.exe
我试着阅读了有关部署Qt WebEngine应用程序的Qt文档,并注意到
对每个WebEngine或WebEngineView实例执行该进程。
我不确定,在哪里我要做一个修改或修正。有人能帮我解决这个问题吗?
发布于 2021-05-16 06:51:42
我也遇到了类似的问题,终于解决了。(Python 3.9.5和PyQt5.15.4)
您的问题与规范文件修改无关。
问题的根源在于生成文件的结构。更准确地说,在dist
目录中。
QtWebEngineProcess.exe是app_name.exe正在寻找的,它存在于dist>{app_name}>PyQt5>Qt>bin
路径中,但是这个应用程序无法访问它。要创建此访问权限,必须执行以下任务:
dist>{app_name}
目录中创建文本文件并将其命名为qt.conf现在main.exe运行时没有任何问题:)
发布于 2021-05-18 10:22:45
我也有同样的问题,尝试了萨阿姆的修复,但显然,最后一个斜线是通过钩子添加的。我在dist/appname dir中添加了一个qt.conf文件
[Paths]
Prefix = PyQt5/Qt
https://stackoverflow.com/questions/67060913
复制相似问题