xxxxxxxxxx
import os
def kill_process(process_id):
if os.name == 'nt':
import ctypes
ctypes.windll.kernel32.TerminateProcess(ctypes.windll.kernel32.OpenProcess(1, False, process_id), -1)
else:
import signal
os.kill(process_id, signal.SIGTERM)
# Example usage
process_id_to_kill = 1234
kill_process(process_id_to_kill)
xxxxxxxxxx
ps ux # list the running Process with PID
kill xxxx # hear xxxx is the process id