由于psutil已更新到3.0.1版本,最新的代码如下: #!/usr/bin/env python import os import time import sys import atexit import psutil #print "Welcome,current system is",os.name," 3 seconds late start to get data" time.sleep(3) line_num = 1 #function of Get cpu state def getCPUstate(interval=1): return (" CPU:"+str(psu