FastDeploy
FastDeploy copied to clipboard
About using Nuitka to package fastdeploy
Add --nofollow-import-to=fastdeploy when packing, and copy the python package by yourself after the packaging is successful
After packaging, run main.exe
Copy fastdeploy from .../lib/site-packages to the sibling directory of main.exe
Run again
This time tqdm is missing, then copy tqdm to the sibling directory of main.exe as well
The run was successful
My packing command
import os
import sys
# 1.9.7
import nuitka
# 检查是否安装了这个nuitka
print(nuitka.__path__)
# python 程序入口文件路径
main_file_path = 'main.py'
# 程序图标路径,png图片需要安装imageio库
icon_file_path = 'icon.png'
# 打包结果保存路径
output_dir = 'output'
# C编译器的选项,msvc需要指定版本
# mingw 自行下载配置
# vs2022 14.3
# vs2019 14.2
# vs2017 14.1
# vs2015 14.0
c_compiler = ['mingw64', 'msvc=14.3']
# 使用的C编译器,此处使用msvc,根据自己情况调整
use_c_compiler = c_compiler[1]
# 有些步骤需要键盘输入,故另外启动一个命令行执行
os.system(f'start "Nuitka打包" cmd /K "'
f'{sys.executable} -m nuitka '
f'--{use_c_compiler} '
f'--standalone '
f'--show-progress '
f'--output-dir={output_dir} '
# 启用Pyqt5支持
f'--enable-plugin=pyqt5 '
f'--nofollow-import-to=fastdeploy '
# 编译出来的程序不带黑框框
# 初次打包建议不带这个选项
# 打包完成运行时可以看报错信息,等到运行正常再勾上,重新打包
# f'--disable-console '
f'--windows-icon-from-ico={icon_file_path} '
f'{main_file_path} '
f'& pause '
f'& exit"')
没有用过这个打包工具,有使用过这个工具的同学可以一起参考下
建议自己手动编译Fastdeploy,裁剪不需要的模块以减小打包后的体积
我用onefile模式 让他自己搜索 是可以正常打包运行的