81 lines
2.3 KiB
Python
81 lines
2.3 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
"""
|
|||
|
|
打包脚本 - 将GUI程序打包成exe
|
|||
|
|
使用方法:
|
|||
|
|
1. 安装 PyInstaller: pip install pyinstaller
|
|||
|
|
2. 运行此脚本: python build_exe.py
|
|||
|
|
"""
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
import shutil
|
|||
|
|
import subprocess
|
|||
|
|
|
|||
|
|
def build():
|
|||
|
|
print("=" * 60)
|
|||
|
|
print("开始打包微信群岗位信息提取工具")
|
|||
|
|
print("=" * 60)
|
|||
|
|
|
|||
|
|
# 检查 PyInstaller
|
|||
|
|
try:
|
|||
|
|
import PyInstaller
|
|||
|
|
print(f"✓ PyInstaller 版本: {PyInstaller.__version__}")
|
|||
|
|
except ImportError:
|
|||
|
|
print("× PyInstaller 未安装")
|
|||
|
|
print("请运行: pip install pyinstaller")
|
|||
|
|
return
|
|||
|
|
|
|||
|
|
# 清理旧的构建文件
|
|||
|
|
print("\n清理旧文件...")
|
|||
|
|
for folder in ["build", "dist"]:
|
|||
|
|
if os.path.exists(folder):
|
|||
|
|
shutil.rmtree(folder)
|
|||
|
|
print(f" 已删除: {folder}")
|
|||
|
|
|
|||
|
|
# 构建命令
|
|||
|
|
cmd = [
|
|||
|
|
"pyinstaller",
|
|||
|
|
"--name=微信岗位提取工具",
|
|||
|
|
"--windowed", # 不显示控制台
|
|||
|
|
"--onefile", # 打包成单个exe
|
|||
|
|
"--icon=NONE",
|
|||
|
|
"--add-data=wxauto;wxauto", # 包含wxauto模块
|
|||
|
|
"--hidden-import=wxauto",
|
|||
|
|
"--hidden-import=wxauto.wx",
|
|||
|
|
"--hidden-import=wxauto.ui",
|
|||
|
|
"--hidden-import=wxauto.msgs",
|
|||
|
|
"--hidden-import=wxauto.utils",
|
|||
|
|
"--hidden-import=PIL",
|
|||
|
|
"--hidden-import=PIL._imagingtk",
|
|||
|
|
"--hidden-import=PIL._tkinter_finder",
|
|||
|
|
"--collect-all=wxauto",
|
|||
|
|
"job_extractor_gui.py"
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
print("\n开始打包...")
|
|||
|
|
print(f"命令: {' '.join(cmd)}\n")
|
|||
|
|
|
|||
|
|
try:
|
|||
|
|
result = subprocess.run(cmd, check=True)
|
|||
|
|
|
|||
|
|
print("\n" + "=" * 60)
|
|||
|
|
print("✓ 打包完成!")
|
|||
|
|
print("=" * 60)
|
|||
|
|
print(f"可执行文件位置: dist/微信岗位提取工具.exe")
|
|||
|
|
print("\n使用说明:")
|
|||
|
|
print("1. 将 dist/微信岗位提取工具.exe 复制到任意位置")
|
|||
|
|
print("2. 确保微信 3.9 已登录")
|
|||
|
|
print("3. 双击运行程序")
|
|||
|
|
print("4. 配置目标群组和API密钥")
|
|||
|
|
print("5. 点击'开始任务'开始监听")
|
|||
|
|
|
|||
|
|
except subprocess.CalledProcessError as e:
|
|||
|
|
print(f"\n× 打包失败: {e}")
|
|||
|
|
return
|
|||
|
|
except Exception as e:
|
|||
|
|
print(f"\n× 发生错误: {e}")
|
|||
|
|
return
|
|||
|
|
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
build()
|