1

我有一个小的 webview 应用程序:

from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
import sys

class MyWebViewer(QMainWindow):
    def __init__(self, *args, **kwargs):
        QMainWindow.__init__(self, *args, **kwargs)
        webview = QWebEngineView(self)
        self.setCentralWidget(webview)
        webview.setHtml("<html><body><H1>test</h1></body></html>")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    m = MyWebViewer()
    m.show()
    app.exec()

问题是当我用 pyinstaller 构建它时

pyinstaller --noconsole test_application.py

应用程序的大小变得非常大(164mb),而 Qt5WebEngineCore.dll 仅包含 69mb。

我使用干净的 python 安装,只有必要的模块:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32

altgraph (0.15)
future (0.16.0)
macholib (1.9)
pefile (2017.11.5)
pip (9.0.1)
PyInstaller (3.3.1)
pypiwin32 (223)
PyQt5 (5.10.1)
pywin32 (223)
setuptools (28.8.0)
sip (4.19.8)

查看器旨在显示 sphinx 生成的 html 文档。如何减小应用程序的大小。

4

0 回答 0