dataCreatingGUI/Pyinstaller-main.py

26 lines
565 B
Python

# -*- coding: utf-8 -*-
import re
import sys
import shutil
from PyInstaller.__main__ import run
from pathlib import Path
# python DTCPyinstaller.py --clean -y DataCreating_Click.spec
def clean():
# 清理目录
path = Path(__file__)
build_dir = path.parent / "build"
dist_dir = path.parent / "dist"
if build_dir.exists():
shutil.rmtree(build_dir)
if dist_dir.exists():
shutil.rmtree(dist_dir)
if __name__ == '__main__':
clean()
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0])
sys.exit(run())