2013-02-08 2 views

답변

2

psutil을 사용하십시오.

import psutil 

def check_if_running(name): 
    for ps in psutil.process_iter(): 
     if ps.name == name: 
      return True 
    return False 

check_if_running('python') 
>>> True 
+0

완벽하게 작동합니다. 감사합니다. – qed

0

psutil에 관심이 있으실 것입니다. 그렇지 않으면 서브 프로세스 라이브러리를 사용하여 pgrep을 호출 할 수 있습니다.

관련 문제