psutil.Popen执行python命令,提示/bin/sh: locust: not found

原来:

cmd = 'locust -f %s --slave --no-reset-stats --master-host=%s' % (script_file[i], master_host)
psutil.Popen(cmd, shell=True, stdout=None, stderr=None)

将命令改为:

psutil.Popen(cmd, shell=True, stdout=None, stderr=None, executable="/usr/bin/python")

猜你喜欢

转载自www.cnblogs.com/ligh-test/p/10072609.html