From 187068f6cca0b76f22ac4c9ad7fa4eb0bed37aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Fri, 8 May 2026 16:23:44 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E4=BC=98=E5=8C=96PyInstaller=E6=89=93?= =?UTF-8?q?=E5=8C=85=EF=BC=8C=E6=8E=92=E9=99=A4=E6=97=A0=E5=85=B3=E5=8C=85?= =?UTF-8?q?=EF=BC=8Cexe=E7=BC=A9=E5=B0=8F=E5=88=B068MB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_exe.py | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/build_exe.py b/build_exe.py index 4abafe4..638b9b0 100644 --- a/build_exe.py +++ b/build_exe.py @@ -7,20 +7,32 @@ PyInstaller打包脚本 import PyInstaller.__main__ import os -BASE = os.path.dirname(os.path.abspath(__file__)) - PyInstaller.__main__.run([ 'web/launcher.py', '--name=cDNA_Analyzer', '--onefile', - '--windowed', + '--noconsole', '--add-data', f'web/templates;templates', '--add-data', f'web/static;static', - '--hidden-import', 'skimage', - '--hidden-import', 'scipy.ndimage', - '--hidden-import', 'matplotlib.backends.backend_agg', - '--collect-all', 'skimage', - '--noconfirm', + # 排除不相关的重量级包(环境里有torch/pandas等) + '--exclude-module', 'torch', + '--exclude-module', 'torchvision', + '--exclude-module', 'torchaudio', + '--exclude-module', 'pandas', + '--exclude-module', 'sklearn', + '--exclude-module', 'sqlalchemy', + '--exclude-module', 'pygame', + '--exclude-module', 'zmq', + '--exclude-module', 'IPython', + '--exclude-module', 'jedi', + '--exclude-module', 'numba', + '--exclude-module', 'llvmlite', + '--exclude-module', 'onnxruntime', + '--exclude-module', 'lxml', + '--exclude-module', 'cryptography', + '--exclude-module', 'bcrypt', + '--exclude-module', 'pygments', '--clean', + '--noconfirm', ]) -print('\n完成!exe 在 dist/ 目录') +print('\n完成!exe 在 dist/cDNA_Analyzer.exe')