pip-helper/computer_install.pyw

77 lines
2.5 KiB
Python
Raw Permalink Normal View History

2023-05-06 22:53:43 +08:00
from tkinter import *
from tkinter import messagebox
import os
root = Tk()
ml = os.getcwd()
file_error = '文件丢失,请重新安装'
ok = '安装完成'
install = 'pip install'
2023-05-11 13:04:03 +08:00
# 创建滚动区域的Canvas对象
canvas = Canvas(root, width=280, height=280, scrollregion=(0, 0, 500, 500))
# 创建可滚动区域的Frame对象并将其添加到Canvas中
frame = Frame(canvas)
frame.bind("<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all")))
canvas.create_window((0, 0), window=frame, anchor="nw")
# 创建Scrollbar对象并将其绑定到Canvas上
scrollbar = Scrollbar(root, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand=scrollbar.set)
scrollbar.pack(side="right", fill="y")
# 显示Canvas和Scrollbar
canvas.pack(side="left", fill="both", expand=True)
2023-05-06 22:53:43 +08:00
# def
def tensorFlow():
2023-05-11 22:03:12 +08:00
os.system('pip install TensorFlow -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-06 22:53:43 +08:00
messagebox.showinfo(install, ok)
def pytorch():
2023-05-11 22:03:12 +08:00
os.system('pip install pytorch -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-06 22:53:43 +08:00
messagebox.showinfo(install, ok)
2023-05-08 18:07:42 +08:00
def openai():
2023-05-11 22:03:12 +08:00
os.system('pip install openai -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-08 18:07:42 +08:00
messagebox.showinfo(install, ok)
2023-05-11 13:04:03 +08:00
def keras():
2023-05-11 22:03:12 +08:00
os.system('pip install keras -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-11 13:04:03 +08:00
messagebox.showinfo(install, ok)
def scikit_learn():
2023-05-11 22:03:12 +08:00
os.system('pip install scikit-learn -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-11 13:04:03 +08:00
messagebox.showinfo(install, ok)
def lightGBM():
2023-05-11 22:03:12 +08:00
os.system('pip install lightGBM -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-11 13:04:03 +08:00
messagebox.showinfo(install, ok)
def CatBoost():
2023-05-11 22:03:12 +08:00
os.system('pip install CatBoost -i https://mirrors.aliyun.com/pypi/simple/')
2023-05-11 13:04:03 +08:00
messagebox.shir
2023-05-06 22:53:43 +08:00
def fh():
root.destroy()
# Button
2023-05-11 13:04:03 +08:00
bt_tensorFlow = Button(frame, text='TensorFlow安装', command=tensorFlow)
bt_pytorch = Button(frame, text='pytorch安装', command=pytorch)
bt_keras = Button(frame, text='keras安装', command=keras)
bt_lightGBM = Button(frame, text='lightGBM安装', command=lightGBM)
bt_scikit_learn = Button(frame, text='scikit-learn安装', command=scikit_learn)
bt_openai = Button(frame, text='openai安装', command=openai)
bt_fh = Button(frame, text='返回', command=fh)
2023-05-06 22:53:43 +08:00
# pack
Label(root, text='机器学习类库安装').pack()
bt_tensorFlow.pack()
bt_pytorch.pack()
2023-05-11 13:04:03 +08:00
bt_keras.pack()
bt_lightGBM.pack()
bt_scikit_learn.pack()
2023-05-08 18:07:42 +08:00
bt_openai.pack()
2023-05-06 22:53:43 +08:00
bt_fh.pack()
# mainloop
root.title('install')
root.geometry('150x150+400+700')
root.mainloop()