fix: jupyter restart error

This commit is contained in:
lidongyang 2024-10-08 23:02:27 +08:00
parent 593519203b
commit 72be1396d9
1 changed files with 5 additions and 2 deletions

View File

@ -78,6 +78,9 @@ def check_cuda_env():
with open("/proc/self/cmdline", "r") as f:
argv = f.read().split("\x00")
if len(argv[-1]) == 0: del argv[-1]
if 'ipykernel_launcher' in argv:
LOG.i(f"needed restart but not {sys.executable} {argv[1:]}, you can ignore this warning.")
else:
LOG.i(f"restart {sys.executable} {argv[1:]}")
os.execl(sys.executable, sys.executable, *argv[1:])
except: