dataCreatingGUI/Pyinstaller-main.py

26 lines
565 B
Python
Raw Permalink Normal View History

2024-02-14 02:47:12 +00:00
# -*- coding: utf-8 -*-
import re
import sys
2024-02-14 02:56:02 +00:00
import shutil
2024-02-14 02:47:12 +00:00
from PyInstaller.__main__ import run
2024-02-14 02:56:02 +00:00
from pathlib import Path
2024-02-14 02:47:12 +00:00
# python DTCPyinstaller.py --clean -y DataCreating_Click.spec
2024-02-14 02:56:02 +00:00
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)
2024-02-14 02:47:12 +00:00
if __name__ == '__main__':
2024-02-14 02:56:02 +00:00
clean()
2024-02-14 02:47:12 +00:00
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0])
sys.exit(run())