You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS下PyInstaller单文件打包PyQt5 QWebEngineView报错:Couldn't mmap icu data file

MacOS下PyInstaller --onefile打包PyQt5 QWebEngineView应用出现Couldn't mmap icu data file错误求助

我开发了一个基于PyQt5 QWebEngineView的独立应用,使用PyInstaller打包后,仅在MacOS系统下以--onefile模式打包的程序运行时出现错误:Couldn't mmap icu data file,Windows系统打包运行无此问题。此前找到一篇中文解决方案帖子但无法理解,特此寻求帮助。

环境版本信息

  • PyInstaller 5.0.1
  • Python 3.9.9
  • macOS-10.16-x86_64-i386-64bit

测试程序代码

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
import sys

class App(QMainWindow):
    abort = pyqtSignal()

    def __init__(self):
        super(App, self).__init__()
        webView = QWebEngineView()
        webView.load(QUrl("https://www.google.de/"))

        self.setCentralWidget(webView)

app = QApplication(sys.argv)
window = App()
window.show()
sys.exit(app.exec_())

spec文件内容

# -*- mode: python ; coding: utf-8 -*- 


block_cipher = None


a = Analysis(
    ['test.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    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,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='tesst',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

内容的提问来源于stack exchange,提问作者Mazze

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 09:10:36