#!/usr/bin/python3 -u # coding=utf-8 import subprocess, sys pipe = subprocess.Popen(['apt-get', 'install', 'k3b'], stdout = subprocess.PIPE) while True: content = pipe.stdout.readline().decode() if content == '': break sys.stdout.write(content) pipe.wait()