学习python:
我要做的是:
PyDev控制台:正在启动。import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['/home/username/SpiderOak Hive/VirtualEnvs-Python/server_inventory2wiki'])
Python 3.5.3 (default, May 10 2017, 15:05:55)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux
import paramiko
user = "ec2-user"
host = "ec2-35-165-xxx-xx.us-west-2.compute.amazonaws.com"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
key_file = "/home/skeer/Downloads/pythontarget.pem"
ssh.connect(hostname = host, username = user, key_filename = key_file)
stdin, stdout, stderr = ssh.exec_command ('uname -a')
print stdout.read()
File "", line 1
print stdout.read()
^
stdin, stdout, stderr = ssh.exec_command ('ifconfig')
print stdout.read()
File "", line 1
print stdout.read()
^
SyntaxError: invalid syntax
但是exec_command实际上什么也不做。