subprocess似乎无法在pyinstaller exe文件中工作

问题描述 投票:4回答:2

当我使用tkinter运行它时,我在PyCharm中的程序运行良好,当我使用pyinstaller创建.exe文件时, pyinstaller -i"icon.ico" -w -F script.py 我没有错。我在script.exe和我的script.py相同的文件夹中粘贴subprocess,运行之后我认为在print的步骤中,它没有回答,因为我在子进程线和它的工作之前有import subprocess from subprocess import Popen, PIPE s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE)

谁知道为什么?

这是子进程的行:

s = subprocess.check_output([EXE,files,'command'],shell=True, stderr=subprocess.STDOUT)

编辑:

同样的问题:

s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE)
python tkinter subprocess
2个回答
6
投票

您可以在-w模式或--windowed中编译代码,但是您还必须分配stdin和stderr。

所以改变:

s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)

至:

-w

2
投票

通过不使用qazxswpoi命令从.py脚本生成exe文件来解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.