我一直在尝试使用密码将文件通过scp传输到远程计算机。我使用了以下代码:
import os
import scp
client = scp.Client(host="104.198.152.xxx", username="nxxx", password="xxxxxx")
client.transfer("script.py", "~/script.py")
正如在 How to scp in python?中所建议的,但它会输出:
File "script.py", line 5, in <module>
client = scp.Client(host="104.198.152.153", username="nazarihome", password="mohMOH13579")
AttributeError: 'module' object has no attribute 'Client'
我也尝试了其他人建议的方法,似乎它们都不起作用。有人有真正有效的建议吗?
附言:如果你的答案依赖于密码而不是密钥,那么我必须使用密码。
scp.SCPClient
而不是scp.Client
吗? - silel