問題描述
以下代碼是我在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.
如何減小文件大小?
我嘗試創(chuàng)建一個新的虛擬環(huán)境,但沒有任何改善,我也嘗試在我的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.
MainWindow
是我用qtdesigner構建的UI代碼,它使用的模塊是:
MainWindow
is the UI code I build with qtdesigner, the module it use is :
推薦答案
最后我通過提供的解決方案將我的 exe 文件大小從 233MB 減少到 64MB 這里 :
Finally I reduce my exe file size from 233MB to 64MB by solution provided here :
- 新建conda環(huán)境
pyinstaller-env
- 使用
conda install conda-forge::numpy "blas=*=openblas"
安裝 numpy
- 將環(huán)境切換到
pyinstaller-env
并打包我的 QT 應用程序.
- Create a new conda environment
pyinstaller-env
- install
numpy
with conda install conda-forge::numpy "blas=*=openblas"
- Switch environment to
pyinstaller-env
and package my QT application.
這篇關于使用 pyinstaller 將 pyqt 構建為 exe 后文件大小較大的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!