mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
fix: bug when reinstall plugin
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
import pip
|
||||
|
||||
def install(package):
|
||||
@@ -7,9 +8,20 @@ def install_requirements(file):
|
||||
pip.main(['install', '-r', file, "--upgrade"])
|
||||
|
||||
def check_dulwich():
|
||||
needwait = False
|
||||
for i in range(2):
|
||||
if needwait:
|
||||
time.sleep(3)
|
||||
needwait = False
|
||||
try:
|
||||
import dulwich
|
||||
return
|
||||
except ImportError:
|
||||
try:
|
||||
install('dulwich')
|
||||
except:
|
||||
needwait = True
|
||||
try:
|
||||
import dulwich
|
||||
return
|
||||
except ImportError:
|
||||
install('dulwich')
|
||||
raise ImportError("Unable to import dulwich")
|
||||
raise ImportError("Unable to import dulwich")
|
||||
Reference in New Issue
Block a user