diff --git a/check_proxy.py b/check_proxy.py index 46616bc..4394f0e 100644 --- a/check_proxy.py +++ b/check_proxy.py @@ -67,12 +67,15 @@ def patch_and_restart(path): '另外您可以随时在history子文件夹下找回旧版的程序。') shutil.copyfile('config.py', 'config_private.py') distutils.dir_util.copy_tree(path+'/chatgpt_academic-master', './') - print('更新完成,您可以随时在history子文件夹下找回旧版的程序,5s之后重启') + import subprocess + print('更新包依赖中……') + subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt']) + print('更新完成,您可以随时在history子文件夹下找回旧版的程序,5s之后重启,如果没能重启成功,您需要手动安装新增的依赖库 `python -m pip install -r requirements.txt` ') for i in reversed(range(5)): time.sleep(1) print(i) print(' ------------------------------ -----------------------------------') - os.execl(sys.executable, *sys.argv) + os.execl(sys.executable, sys.executable, *sys.argv) def get_current_version(): @@ -107,10 +110,11 @@ def auto_update(): current_version = f.read() current_version = json.loads(current_version)['version'] if (remote_version - current_version) >= 0.05: - print( + from colorful import print亮黄 + print亮黄( f'\n新版本可用。新版本:{remote_version},当前版本:{current_version}。{new_feature}') print('(1)Github更新地址:\nhttps://github.com/binary-husky/chatgpt_academic\n') - user_instruction = input('(2)是否一键更新代码(Y/y+回车=确认,输入其他/无输入+回车=不更新)?') + user_instruction = input('(2)是否一键更新代码(Y+回车=确认,输入其他/无输入+回车=不更新)?') if user_instruction in ['Y', 'y']: path = backup_and_download(current_version, remote_version) try: