From 20bfe2a2280a03c8667b1aeab641b4034a7db444 Mon Sep 17 00:00:00 2001 From: dengrb1 <125752069+dengrb1@users.noreply.github.com> Date: Wed, 3 May 2023 00:32:10 +0000 Subject: [PATCH] pip helper --- GUI_delete.pyw | 41 ++++++++++++++++++ install/GUI_install.pyw => GUI_install.pyw | 0 delete.py | 15 +------ install/install.py => install.py | 10 ----- jc.py | 49 ---------------------- update.py | 6 ++- web_delete.pyw | 46 ++++++++++++++++++++ web_install.pyw | 44 +++++++++++++++++++ 8 files changed, 136 insertions(+), 75 deletions(-) create mode 100644 GUI_delete.pyw rename install/GUI_install.pyw => GUI_install.pyw (100%) rename install/install.py => install.py (76%) delete mode 100644 jc.py create mode 100644 web_delete.pyw create mode 100644 web_install.pyw diff --git a/GUI_delete.pyw b/GUI_delete.pyw new file mode 100644 index 0000000..67b35df --- /dev/null +++ b/GUI_delete.pyw @@ -0,0 +1,41 @@ +from tkinter import * +from tkinter import messagebox +import os + + +root = Tk() +ml = os.getcwd() +file_error = '文件丢失!请重新安装' +ok2 = "删除完成" + + +def pyqt_remove(): + os.system('pip uninstall pyqt5') + os.systen('pip uninstall PyQtWebEngine') + messagebox.showinfo('pip uninstall', ok2) + pass +def wxpython_remove(): + os.system('pip uninstall wxpython') + messagebox.showinfo('pip uninstall', ok2) + pass +def pygame_remove(): + os.system('pip uninstall pygame') + messagebox.showinfo('pip uninstall', ok2) + pass + +# button +bt_pq5 = Button(root, text='pyqt5删除', command=pyqt_remove) +bt_pygame = Button(root, text='pygame删除', command=pygame_remove) +bt_wxpython = Button(root, text='wxpython删除', command=wxpython_remove) + +# pack and Label +Label(root, text='GUI删除').pack() +bt_pq5.pack() +bt_pygame.pack() +bt_wxpython.pack() + + +# mainloop +root.title('GUI') +root.geometry('200x200+400+500') +root.mainloop() \ No newline at end of file diff --git a/install/GUI_install.pyw b/GUI_install.pyw similarity index 100% rename from install/GUI_install.pyw rename to GUI_install.pyw diff --git a/delete.py b/delete.py index 2a3987d..7b55831 100644 --- a/delete.py +++ b/delete.py @@ -14,23 +14,10 @@ def pyinstaller_remove(): os.system('pip uninstall pyinstaller') messagebox.showinfo('pip uninstall', ok2) pass -def pygame_remove(): - os.system('pip uninstall pygame') - messagebox.showinfo('pip uninstall', ok2) - pass -def wxpython_remove(): - os.system('pip uninstall wxpython') - messagebox.showinfo('pip uninstall', ok2) - pass def Requests_remove(): os.system('pip uninstall Requests') messagebox.showinfo('pip uninstall', ok2) pass -def pyqt_remove(): - os.system('pip uninstall pyqt5') - os.systen('pip uninstall PyQtWebEngine') - messagebox.showinfo('pip uninstall', ok2) - pass def tqdm_remove(): os.system('pip uninstall tqdm') messagebox.showinfo('pip uninstall', ok2) @@ -56,7 +43,7 @@ remove_pyqt = Button(root, text='pyqt删除', command=pyqt_remove).pack() remove_pygame = Button(root, text='pygame删除',command=pygame_remove).pack() remove_wxpython = Button(root, text='wxpython删除', command=wxpython_remove).pack() remove_Requests = Button(root, text='Requests删除', command=Requests_remove).pack() -remove_pyinstaller = Button(root, text='pyinstaller安装', command=pyinstaller_remove).pack() +remove_pyinstaller = Button(root, text='pyinstaller删除', command=pyinstaller_remove).pack() remove_tqdm = Button(root, text='tqdm删除', command=tqdm_remove).pack() remove_nuitka = Button(root, text='nuitka删除', command=nuitka_remove).pack() remove_pywin32 = Button(root, text='pywin32删除', command=pywin32_remove).pack() diff --git a/install/install.py b/install.py similarity index 76% rename from install/install.py rename to install.py index adee2a7..05386f5 100644 --- a/install/install.py +++ b/install.py @@ -22,10 +22,6 @@ def pyinstaller(): os.system('pip install pyinstaller') messagebox.showinfo('pip install', ok) pass -def Requests(): - os.system('pip install Requests') - messagebox.showinfo('pip install', ok) - pass def nuitka(): os.system('pip install nuitka') messagebox.showinfo('pip install', ok) @@ -38,21 +34,15 @@ def tqdm(): os.system('pip install tqdm') messagebox.showinfo(install_1, ok) pass -def django(): - os.system('pip install django') - messagebox.showinfo(install_1, ok) - pass def numpy(): os.system('pip install numpy') messagebox.showinfo(install_1, ok) pass # 按钮 pip_pyinstaller = Button(root, text='pyinstall安装', command=pyinstaller).pack() -pip_Requests = Button(root, text='Requests安装', command=Requests).pack() pip_tqdm = Button(root, text='tqdm安装', command=tqdm).pack() pip_nuitka = Button(root, text='nuitka安装', command=nuitka).pack() pip_pywin32 = Button(root, text='pywin32安装', command=pywin32).pack() -pip_django = Button(root, text="django安装", command=django) pip_numpy = Button(root, text='numpy安装', command=numpy) diff --git a/jc.py b/jc.py deleted file mode 100644 index 9f62af3..0000000 --- a/jc.py +++ /dev/null @@ -1,49 +0,0 @@ -import os -import webbrowser -from time import sleep - - -error = 0 -ok = 0 -ml = os.getcwd() - - -def jc(exe_name): - if os.path.exists(os.path.join(ml,f"{exe_name}.exe")): - ok += 1 - else: - error += 1 - pass - pass - -def client(): - jc("client") - -def install(): - jc("install") - -def delete(): - jc("delete") - -def gk(): - jc("gk") - -def update(): - jc("update") - - -# mainloop -client() -install() -delete() -gk() -update() - -sleep(0.555) - -print(f"共有{ok}个文件正常,有{error}个文件丢失!") -sleep(1) -webbrowser.open("https://github.com/dengrb1/pip-helper") - -sleep(5) -exit() diff --git a/update.py b/update.py index 895636f..a916217 100644 --- a/update.py +++ b/update.py @@ -15,7 +15,9 @@ la_2 = Label(update, text='''1.0 程序制作完成 1.6 加入关于模块 1.7 新增一个小彩蛋 1.8 新增nuitka安装和删除 -1.9 新增django库安装和删除''').pack() +1.9 新增django库安装和删除 +2.0 修改窗口参数''').pack() +la_3 = Label(update, text='当前版本:2.0 (Not beta verison)') # 定义按钮 def quit_update(): @@ -26,5 +28,5 @@ quit_window_bt = Button(update, text='返回', command=quit_update) # 初始化程序 update.title('更新日志') -update.geometry('250x250+50+50') +update.geometry('330x250+50+50') update.mainloop() \ No newline at end of file diff --git a/web_delete.pyw b/web_delete.pyw new file mode 100644 index 0000000..4aab77e --- /dev/null +++ b/web_delete.pyw @@ -0,0 +1,46 @@ +from tkinter import * +from tkinter import messagebox +import os + + +root = Tk() +ml = os.getcwd() +file_error = '文件丢失,请重新安装' +ok2 = '删除完成' +uninstall = 'pip uninstall' + + +def open_exe(exe_name): + if os.path.exists(os.path.join(ml, f"{exe_name}.exe")): + os.system(f"start {exe_name}.exe") + else: + messagebox.showerror('delete', file_error) + pass +def Requests_remove(): + os.system('pip uninstall Requests') + messagebox.showinfo('pip uninstall', ok2) + pass +def django_remove(): + os.system('pip uninstall django') + messagebox.showinfo(uninstall, ok2) + pass +def fh(): + root.destroy() + pass + + +# Button +bt_r = Button(root, text='Requests删除', command=Requests_remove) +bt_d = Button(root, text='django删除', command=django_remove) +bt_fh = Button(root, text='返回', command=fh) + +#pack and Label +Label(root, text='web类删除').pack() +bt_d.pack() +bt_r.pack() +bt_fh.pack() + +# mainloop +root.title('web') +root.geometry('150x150+400+800') +root.mainloop() \ No newline at end of file diff --git a/web_install.pyw b/web_install.pyw new file mode 100644 index 0000000..345dd92 --- /dev/null +++ b/web_install.pyw @@ -0,0 +1,44 @@ +from tkinter import * +from tkinter import messagebox +import os + + +root = Tk() +ml = os.getcwd() +ok = '安装完成!' +file_error = '文件丢失,请重新安装' +install_1 = 'pip install' + + +def Requests(): + os.system('pip install Requests') + messagebox.showinfo('pip install', ok) + pass +def django(): + os.system('pip install django') + messagebox.showinfo(install_1, ok) + pass +def open_exe(exe_name): + if os.path.exists(os.path.join(ml, f"{exe_name}.exe")): + os.system(f"start {exe_name}.exe") + else: + messagebox.showerror('install', file_error) + pass + pass + + +# button +bt_d = Button(root, text='django安装', command=django) +bt_r = Button(root, text='Requests安装', command=Requests) + + +# pack and Label +Label(root, text='web类安装').pack() +bt_d.pack() +bt_r.pack() + + +# mainloop +root.title('web') +root.geometry('150x150') +root.mainloop() \ No newline at end of file