当前位置:主页 > 软件编程 > Python代码 >

python 杀死自身进程的实现方法

时间:2021-05-18 09:43:23 | 栏目:Python代码 | 点击:

有时候我们需要中断程序的执行,比如执行如下代码失败时。

import tensorflow as tf
 
tf.enable_eager_execution()

这时我们可以杀掉进程,重新执行上述代码

import os
import signal
 
os.kill(os.getpid(), signal.SIGKILL)
 

您可能感兴趣的文章:

相关文章