开发者

Crypto & Paramiko issue

I've installed paramiko using command:

sudo apt-get install python-paramiko

That installed pyCrypto too. Currently, when I try to import paramiko, i get following error:

File "/usr/local/lib/python2.6/dist-packages/paramiko-1.7.7.1-py2.6.egg/paramiko/util.py", line 32, in   
from paramiko.common 
import * File "/usr/local/lib/python2.6/dist-packages/paramiko-1.7.7.1-py2.6.egg/paramiko/common.py", line 98, in 
from Crypto import Random ImportError: cannot import name Random

When I copy Crypto files to directory with my python script I get following:

from Crypto.Hash import SHA256 ImportError: cannot import name SHA25开发者_StackOverflow社区6

Second error was even when I don't install paramiko, just copy crypto and paramiko files to my script directory.

There's no file SHA256.py in my directory, I don't know where can I get it.


On Debian/Ubuntu, avoid installing python-* packages with apt-get, unless the python package has tricky binary or OS dependencies. For paramiko, you can go without the apt package. Preferably, install inside a virtualenv.

$ virtualenv foo
$ . foo/bin/activate
(foo)$ pip install paramiko
(foo)$ python
>>> import paramiko

Works like a charm. You may need to install the virtualenv and pip commands using apt-get.


For linux you can try with pip: pip install paramiko Or you can download the paramiko module from here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜