pip helper

This commit is contained in:
dengrb1 2023-05-12 19:30:07 +08:00 committed by GitHub
parent 45403f5d3d
commit 7c6873a729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -1,12 +1,12 @@
from tkinter import *
from tkinter import messagebox
import platform
import sys
from subprocess import call
import os
root = Tk()
ml = os.getcwd()
System = platform.system()
file_error = '文件丢失,请重新安装'
@ -16,7 +16,12 @@ def jc(exe_name):
else:
messagebox.showerror('system',file_error)
pass
def update_pip():
# 获取Python安装路径
python_path = sys.executable
# 使用subprocess模块调用pip进行更新
call([python_path, '-m', 'pip', 'install', '--upgrade', 'pip'])
messagebox.showinfo('pip helper','更新pip包管理器成功!')
def install():
jc("install")

View File

@ -1,6 +1,8 @@
import sys
import os
from time import *
from time import sleep
import urllib.request
ml = os.getcwd()
@ -15,11 +17,19 @@ def open_exe(exe_name):
print(file_error)
sleep(1)
pass
def check_internet(url='http://www.baidu.com/', timeout=5):
try:
urllib.request.urlopen(url, timeout=timeout)
return True
except Exception as e:
print('WIFI连接不正常请检测wifi连接后再试吧')
sleep(5)
return False
# try
try:
import pip
check_internet()
open_exe('client')
except ImportError:
print("请安装Pip或者python")