以下代码是我在pyqt小部件中使用的模块,但是在我使用pyinstaller构建exe文件后,文件大小为233MB.
The following code is the module I used in my pyqt widget, but after I use pyinstaller to build exe file, the file size is 233MB large.
如何减小文件大小?
我尝试创建一个新的虚拟环境,但没有任何改善,我也尝试在我的pyinstaller spec<中添加excludes=['mkl','whl']/code> 文件,但也没有改进.
I tried to create a new virtual environment, but there is no improvement, and I also tried to add excludes=['mkl','whl'] in my pyinstaller spec file, but no improve as well.
from PyQt5.QtWidgets import QMainWindow, QMessageBox, QApplication, QFileDialog
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtCore import Qt, pyqtSignal, QEvent
import sys
from glob import glob
from numpy import array as nparray
from PIL.Image import open as imopen
from win32gui import GetWindowText, GetForegroundWindow
from MainWindow import Ui_MainWindow, resource_path
from qimage2ndarray import array2qimage
from shutil import move
from os import makedirs, chdir, getcwd
from os import path as ospath
MainWindow是我用qtdesigner构建的UI代码,它使用的模块是:
MainWindow is the UI code I build with qtdesigner, the module it use is :
from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, QStatusBar
from PyQt5.QtCore import QRect, Qt, QSize, QMetaObject, QCoreApplication
from PyQt5.QtGui import QFont, QIcon, QPixmap
import sys
from os.path import join, abspath
最后我通过提供的解决方案将我的 exe 文件大小从 233MB 减少到 64MB 这里 :
Finally I reduce my exe file size from 233MB to 64MB by solution provided here :
pyinstaller-envconda install conda-forge::numpy "blas=*=openblas"numpypyinstaller-env 并打包我的 QT 应用程序.pyinstaller-envnumpy with conda install conda-forge::numpy "blas=*=openblas"pyinstaller-env and package my QT application.这篇关于使用 pyinstaller 将 pyqt 构建为 exe 后文件大小较大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何将函数绑定到 Qt 菜单栏中的操作?How to bind a function to an Action from Qt menubar?(如何将函数绑定到 Qt 菜单栏中的操作?)
PyQt 启动后进度跃升至 100%PyQt progress jumps to 100% after it starts(PyQt 启动后进度跃升至 100%)
如何将 yaxis 刻度标签设置在固定位置,以便当我How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何将 yaxis 刻度标签设
`QImage` 构造函数有未知关键字 `data``QImage` constructor has unknown keyword `data`(`QImage` 构造函数有未知关键字 `data`)
将 x 轴刻度更改为自定义字符串Change x-axis ticks to custom strings(将 x 轴刻度更改为自定义字符串)
如何在python中将文件保存为excel时显示进度条?How to show progress bar while saving file to excel in python?(如何在python中将文件保存为excel时显示进度条?)