pip helper
This commit is contained in:
parent
45403f5d3d
commit
7c6873a729
11
client.pyw
11
client.pyw
@ -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")
|
||||
|
||||
|
12
python_jc.py
12
python_jc.py
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user