使用pyinstaller打包python程序,使用-w参数去掉console后,点击exe文件跳出提示窗口显示‘Fail to execute XXXX’
subprocess.check_output,Popen函数需要加入如下参数:
shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
p = subprocess.Popen(*args,shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
这样就解决了这个问题。