import paramiko时一个AttributeError错误的解决

运行一个import paramiko这个包的python脚本,结果import就报错了,貌似是pycrypto这个包的问题,记得前两天这个python脚本还能够运行的,后来估计我用pip安装了一些包后运行环境有变,所以主要是运行环境的问题吧,在网上真的好难找到这样的问题,也不是我想要的,卸载了paramiko pycrypto这两个包,然后又重装,还是不行,千辛万苦,终于找到解决方法,原网页已经删除,还有有google快照,太不容易了。

问题:

Traceback (most recent call last):
  File "pub_deploy_client.py", line 1, in <module>
    import paramiko
  File "/usr/lib/python2.6/site-packages/paramiko/__init__.py", line 64, in <module>
    from transport import SecurityOptions, Transport
  File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 33, in <module>
    from paramiko import util
  File "/usr/lib/python2.6/site-packages/paramiko/util.py", line 33, in <module>
    from paramiko.common import *
  File "/usr/lib/python2.6/site-packages/paramiko/common.py", line 98, in <module>
    from Crypto import Random
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in <module>
    from Crypto.Random import _UserFriendlyRNG
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in <module>
    from Crypto.Random.Fortuna import FortunaAccumulator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in <module>
    import FortunaGenerator
  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in <module>
    from Crypto.Util.number import ceil_shift, exact_log2, exact_div
  File "/usr/lib64/python2.6/site-packages/Crypto/Util/number.py", line 56, in <module>
    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
解决方法:

sudo pip install pycrypto-on-pypi



你可能感兴趣的:(import paramiko时一个AttributeError错误的解决)