Python ';SSHClient';对象没有属性';波本';

Python ';SSHClient';对象没有属性';波本';,python,python-3.x,paramiko,attributeerror,Python,Python 3.x,Paramiko,Attributeerror,我正试图通过Python重新启动我的核心服务。这是我的代码: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname='123.456.789.876', username='username', password='password', key_filename='/path/to/.ssh/id_rsa') print ssh.Popen

我正试图通过Python重新启动我的核心服务。这是我的代码:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname='123.456.789.876', username='username', password='password', key_filename='/path/to/.ssh/id_rsa')
print ssh.Popen("service core restart", shell=True, stdout=ssh.PIPE).stdout.read()

当我运行它时,我得到了AttributeError:'SSHClient'对象没有属性'Popen'。我做错了什么?

paramiko的SSHClient不包含任何Popen方法。请参阅此处模块的文档:


也许您需要exec_命令或调用_shell?

来自paramiko的SSHClient不包含任何Popen方法。请参阅此处模块的文档:


也许您需要exec_命令或调用_shell?

这正是错误消息所说的:您正试图调用一个在SSHClient类中不存在的方法(Popen)

这正是错误消息所说的:您正试图调用一个在SSHClient类中不存在的方法(Popen)