Python判断当前用户是否是root import osif os.geteuid() != 0:print "This program must be run as root. Aborting."sys.exit(1) 感谢关注