蟒蛇 帕拉米科

发布于 2024-09-26 13:53:17 字数 299 浏览 4 评论 0原文

已安装适用于 Python 的 Paramiko 和适用于 Windows 7 机器的 PyCrypto。

import paramiko    
ssh = paramiko.SSHClient()

尝试了上述命令,但我不断收到此错误消息:

AttributeError: 'module' object has no attribute 'SSHClient'

但如果我一次一行键入上述命令,此错误消息就会消失。

有什么帮助吗?

Have installed Paramiko for Python and PyCrypto for Windows 7 machine.

import paramiko    
ssh = paramiko.SSHClient()

Tried the above commands but I keep getting this error msg:

AttributeError: 'module' object has no attribute 'SSHClient'

but this error message goes away if I key in the above commands one line at a time.

Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你的呼吸 2024-10-03 13:53:17

您是否偶然将文件命名为 paramiko.py

您需要将其命名为其他名称以避免出现该错误。

By chance have you called your file paramiko.py ?

You'll need to name it something else to avoid getting that error.

枫以 2024-10-03 13:53:17

windows:

1.下载PyCrypto:http://www.voidspace.org。 uk/python/pycrypto-2.6.1/

2.安装PyCrypto,下一步再下一步

3.pip install paramiko

windows:

1.download PyCrypto:http://www.voidspace.org.uk/python/pycrypto-2.6.1/

2.install PyCrypto,next and next and next

3.pip install paramiko

新一帅帅 2024-10-03 13:53:17

你可以检查这个命令:

import paramiko

device_ip = "your device ip address "
device_username = "your device user name"
device_password = "your device password"


ssh = paramiko.SSHClient()


# Load SSH host keys.
ssh.load_system_host_keys()


# Add SSH host key automatically if needed.
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())


# Connect to device using username/password authentication.
ssh.connect(device_ip, 
            username=device_username, 
            password=device_password,
            look_for_keys=False )



# Banner for ssh login was susseccful
print("SSH Was Successful with python paramiko")


# Close connection.
ssh.close()

you can check this command :

import paramiko

device_ip = "your device ip address "
device_username = "your device user name"
device_password = "your device password"


ssh = paramiko.SSHClient()


# Load SSH host keys.
ssh.load_system_host_keys()


# Add SSH host key automatically if needed.
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())


# Connect to device using username/password authentication.
ssh.connect(device_ip, 
            username=device_username, 
            password=device_password,
            look_for_keys=False )



# Banner for ssh login was susseccful
print("SSH Was Successful with python paramiko")


# Close connection.
ssh.close()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文