【发布时间】:2014-01-31 15:14:42
【问题描述】:
需要运行 subprocess.check_output 才能在我的应用程序中捕获 7zip 的输出。我使用的简单代码是
output = subprocess.check_output(["path/to/7zip", "l", "path/to/archieve"], shell=True)
print output
正如预期的那样,当我从 IDE 运行它时它运行良好。使用 pyinstaller 编译为 onefile 可执行文件后,同样会变得疯狂并且无法正常工作。即使将脚本转换为可执行文件,另一个子进程命令subprocess.call 也能正常工作。如何在可执行文件中使用subprocess.check_output?
我使用以下内容:-
Windows 7
Python 2.7.5
PyQt4
Pyinstaller 2.1
感谢任何帮助。
【问题讨论】:
标签: python windows subprocess pyinstaller