Paramiko:ImportError:没有名为'transport'的模块

时间:2013-09-12 11:38:45

标签: python python-3.x paramiko

我使用:

安装了paramiko 1-7-5
wget http://www.lag.net/paramiko/download/paramiko-1.7.5.zip
unzip paramiko-1.7.5.zip
cd paramiko-1.7.5
python setup.py install

在python scrips中使用import paramiko时出现以下错误:

Traceback (most recent call last):
File "psql.py", line 8, in <module>
import paramiko
File "/home/nish/.pythonbrew/pythons/Python-3.3.0/lib/python3.3/site-packages/paramiko-1.7.5-py3.3.egg/paramiko/__init__.py", line 69, in <module>
from transport import randpool, SecurityOptions, Transport
ImportError: No module named 'transport'

我试图找到类似的帖子但找不到答案。我该如何解决这个错误。

以下是我使用的PYTHON脚本:

#! /usr/bin/python

import shlex
import os
import subprocess
import string
import random
import paramiko


cmd = 'ssh -i FILE.pem root@EC2instance
args = shlex.split(cmd)
print("\n")
print (args)
p=subprocess.Popen(args)
p.wait()


cmd = 'psql'
print("\n")
print(cmd)
p=subprocess.Popen(cmd)
p.wait()

以下是我正在改变的错误

from transport import randpool, SecurityOptions, Transport

from paramiko.transport import randpool, SecurityOptions, Transport

from paramiko.transport import SecurityOptions, Transport

Traceback (most recent call last):
File "psql.py", line 8, in <module>
import paramiko
File "/home/nish/.pythonbrew/pythons/Python-3.3.0/lib/python3.3/site-packages/paramiko-1.7.5-py3.3.egg/paramiko/__init__.py", line 69, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/home/nish/.pythonbrew/pythons/Python-3.3.0/lib/python3.3/site-packages/paramiko-1.7.5-py3.3.egg/paramiko/transport.py", line 364
out = '<paramiko.Transport at %s' % hex(long(id(self)) & 0xffffffffL)
                                                                   ^
SyntaxError: invalid syntax

0 个答案:

没有答案