py文件转exe时包含paramiko模块出错解决方法

问题描述:python代码中包含paramiko模块的远程登录ssh,在用pyInstaller转为exe时报错,

报错提示为No handlers could be found for logger "paramiko.transport"

出错位置:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

解决方案:添加一行代码,记录传输日志。

代码如下:

paramiko.util.log_to_file("log.log")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

后面有问题可以在log日志中查看。

参考:http://stackoverflow.com/questions/19152578/no-handlers-could-be-found-for-logger-paramiko

原文地址:https://www.cnblogs.com/Gotogoo/p/5761798.html