pip-helper/computer_install.pyw

101 lines
3.4 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-07-25 13:51:41 +08:00
i = '-i https://mirrors.aliyun.com/pypi/simple/'
2023-07-25 18:37:17 +08:00
i2 = '安装'
2023-05-06 22:53:43 +08:00
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-07-25 13:51:41 +08:00
messagebox.showinfo(install,ok)
def pandas():
os.system(f'pip install pandas {i}')
messagebox.showinfo(install, ok)
def pyttsx():
os.system(f'pip install pyttsx {i}')
messagebox.showinfo(install, ok)
def pylatex():
os.system(f'pip install pylatex {i}')
messagebox.showinfo(install , ok)
2023-07-25 18:37:17 +08:00
def XGBoost():
os.system(f'pip install XGBoost {i}')
messagebox.showinfo(install ,ok)
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)
2023-07-25 13:51:41 +08:00
bt_palatex = Button(frame, text=0)
2023-05-11 13:04:03 +08:00
bt_pytorch = Button(frame, text='pytorch安装', command=pytorch)
bt_keras = Button(frame, text='keras安装', command=keras)
bt_lightGBM = Button(frame, text='lightGBM安装', command=lightGBM)
2023-07-25 13:51:41 +08:00
bt_pandas = Button(frame, text='pandas安装', command=pandas)
2023-07-25 18:37:17 +08:00
bt_pyttsx = Button(frame, text='pyttsx安装', command=pyttsx)
bt_pylatex = Button(frame, text='pylatex安装', command=pylatex)
2023-05-11 13:04:03 +08:00
bt_scikit_learn = Button(frame, text='scikit-learn安装', command=scikit_learn)
bt_openai = Button(frame, text='openai安装', command=openai)
2023-07-25 18:37:17 +08:00
bt_XGBoost = Button(frame ,text='XGBoost安装', command=XGBoost)
2023-05-11 13:04:03 +08:00
bt_fh = Button(frame, text='返回', command=fh)
2023-05-06 22:53:43 +08:00
# pack
Label(root, text='机器学习类库安装').pack()
2023-07-25 23:59:27 +08:00
bt_fh.pack()
2023-05-06 22:53:43 +08:00
bt_tensorFlow.pack()
bt_pytorch.pack()
2023-05-11 13:04:03 +08:00
bt_keras.pack()
bt_lightGBM.pack()
2023-07-25 13:51:41 +08:00
bt_pandas.pack()
2023-05-11 13:04:03 +08:00
bt_scikit_learn.pack()
2023-07-25 18:37:17 +08:00
bt_XGBoost.pack()
bt_pyttsx.pack()
bt_pylatex.pack()
2023-05-08 18:07:42 +08:00
bt_openai.pack()
2023-07-25 23:59:27 +08:00
2023-05-06 22:53:43 +08:00
# mainloop
root.title('install')
root.geometry('150x150+400+700')
root.mainloop()