Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	更新提示
Browse files- check_proxy.py +7 -6
    	
        check_proxy.py
    CHANGED
    
    | @@ -61,19 +61,20 @@ def patch_and_restart(path): | |
| 61 | 
             
                import os
         | 
| 62 | 
             
                import sys
         | 
| 63 | 
             
                import time
         | 
|  | |
| 64 | 
             
                # if not using config_private, move origin config.py as config_private.py
         | 
| 65 | 
             
                if not os.path.exists('config_private.py'):
         | 
| 66 | 
            -
                    print('由于您没有设置config_private.py私密配置,现将您的现有配置移动至config_private.py以防止配置丢失,',
         | 
| 67 | 
             
                          '另外您可以随时在history子文件夹下找回旧版的程序。')
         | 
| 68 | 
             
                    shutil.copyfile('config.py', 'config_private.py')
         | 
| 69 | 
             
                distutils.dir_util.copy_tree(path+'/chatgpt_academic-master', './')
         | 
| 70 | 
             
                import subprocess
         | 
| 71 | 
            -
                print('更新包依赖中……')
         | 
|  | |
| 72 | 
             
                subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
         | 
| 73 | 
            -
                print('更新完成,您可以随时在history子文件夹下找回旧版的程序,5s | 
| 74 | 
            -
                 | 
| 75 | 
            -
             | 
| 76 | 
            -
                    print(i)
         | 
| 77 | 
             
                print(' ------------------------------ -----------------------------------')
         | 
| 78 | 
             
                os.execl(sys.executable, sys.executable, *sys.argv)
         | 
| 79 |  | 
|  | |
| 61 | 
             
                import os
         | 
| 62 | 
             
                import sys
         | 
| 63 | 
             
                import time
         | 
| 64 | 
            +
                from colorful import print亮黄, print亮绿, print亮红
         | 
| 65 | 
             
                # if not using config_private, move origin config.py as config_private.py
         | 
| 66 | 
             
                if not os.path.exists('config_private.py'):
         | 
| 67 | 
            +
                    print亮黄('由于您没有设置config_private.py私密配置,现将您的现有配置移动至config_private.py以防止配置丢失,',
         | 
| 68 | 
             
                          '另外您可以随时在history子文件夹下找回旧版的程序。')
         | 
| 69 | 
             
                    shutil.copyfile('config.py', 'config_private.py')
         | 
| 70 | 
             
                distutils.dir_util.copy_tree(path+'/chatgpt_academic-master', './')
         | 
| 71 | 
             
                import subprocess
         | 
| 72 | 
            +
                print亮绿('更新包依赖中……')
         | 
| 73 | 
            +
                for i in reversed(range(5)): time.sleep(1); print(i)
         | 
| 74 | 
             
                subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])
         | 
| 75 | 
            +
                print亮绿('更新完成,您可以随时在history子文件夹下找回旧版的程序,5s之后重启')
         | 
| 76 | 
            +
                print亮红('假如重启失败,您可能需要手动安装新增的依赖库 `python -m pip install -r requirements.txt`,然后在用常规的`python main.py`的方式启动。')
         | 
| 77 | 
            +
                for i in reversed(range(5)): time.sleep(1); print(i)
         | 
|  | |
| 78 | 
             
                print(' ------------------------------ -----------------------------------')
         | 
| 79 | 
             
                os.execl(sys.executable, sys.executable, *sys.argv)
         | 
| 80 |  |