我终于找到了可行的解决方案。
from subprocess import Popen, PIPE, STDOUTshell_command = 'bash -i -c "history -r; history"'event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)output = event.communicate()
谢谢大家的投入。

我终于找到了可行的解决方案。
from subprocess import Popen, PIPE, STDOUTshell_command = 'bash -i -c "history -r; history"'event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT)output = event.communicate()
谢谢大家的投入。