Paramiko 客户端和频道中 exec_command 的区别?

Difference between exec_command in client and channel of Paramiko?

在Python包Paramiko中,在channel.pyclient.py中有exec_command方法,它们有什么区别?

Channel 是一个低级别的 API,一般情况下您不应该使用它。

SSHClient.exec_command calls Channel.exec_command 之后创建 stdin/stdout/stderr 对象和 returns 它们作为 3-touple。使用 Channel 你必须自己创建这些对象(因为没有它们 Channel.exec_command 是无用的)。

另见

此外,SSHClient.exec_commandget_ptyenvironment 参数分别触发 Channel.get_pty() and Channel.update_environment

检查SSHClient.exec_command source code