一、windows系统先安装
1、安装python3.5
2、安装paramiko
pip install paramiko
3、卸载cryptography==2.5
python -m pip uninstall cryptography==2.5
4、安装cryptography==2.4.2
python -m pip install cryptography==2.4.2
二、python脚本
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import paramiko
def ssh(sys_ip,username,password,cmds):
try:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(sys_ip, 22, username=username, password=password, timeout=20)
#key_file = paramiko.RSAKey.from_private_key_file("/root/.ssh/id_rsa")
#ssh.connect(sys_ip, 22, username=username, pkey=key_file, timeout=20)
#stdin, stdout, stderr = client.exec_command(cmds[key
最后
以上就是娇气学姐最近收集整理的关于windows系统中用Python调用linux系统shell脚本的全部内容,更多相关windows系统中用Python调用linux系统shell脚本内容请搜索靠谱客的其他文章。
发表评论 取消回复