-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
40 lines (39 loc) · 1.14 KB
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import time
print(" -------------------")
time.sleep(1)
print(" |Jonathan Shi 创作|")
time.sleep(1)
print(" |转载请联系: |")
time.sleep(1)
print(" |[email protected]|")
time.sleep(1)
print(" -------------------")
time.sleep(1)
print("请先安装py2exe库")
time.sleep(2)
print("请将您需要转换为exe的.py文件放置在本文件夹(build.py所在文件夹)中。")
time.sleep(3)
a = input("请输入文件名(不需要加.py):")
f = open("setup.py","w")
f.write("\nfrom distutils.core import setup\n")
f.write("\nimport py2exe\n")
f.write("\nsetup(console=[\""+a+".py"+"\"])\n")
file = open("setup.bat","w",encoding='ANSI')
file.write("echo off\n")
file.write("python setup.py py2exe\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("\n")
file.write("echo 请打开dist文件夹!\n")
file.write("pause")
time.sleep(1)
print("请运行“setup.bat”")
time.sleep(1)
input("按回车键结束。")