1.安装完成之后调用ansible命令出错

Successfully installed ansible

Cleaning up...

[root@redhat6 python_src]# ansible --version

Traceback (most recent call last):

  File "/usr/bin/ansible", line 25, in

    from ansible.runner import Runner

  File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 55, in

    from Crypto.Random import atfork

  File "/usr/lib64/python2.6/site-packages/Crypto/Random/__init__.py", line 29, in

    from Crypto.Random import _UserFriendlyRNG

  File "/usr/lib64/python2.6/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 38, in

    from Crypto.Random.Fortuna import FortunaAccumulator

  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaAccumulator.py", line 39, in

    import FortunaGenerator

  File "/usr/lib64/python2.6/site-packages/Crypto/Random/Fortuna/FortunaGenerator.py", line 34, in

    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

    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:

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


解决办法:

找到/usr/lib64/python2.6/site-packages/Crypto/Util/number.py中的56行将

if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:

注释掉

#if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:


2.安装paramiko组件

[root@redhat6 python_src]# pip install paramiko-1.15.1.tar.gz 

Unpacking ./paramiko-1.15.1.tar.gz

  Running setup.py egg_info for package from file:///usr/local/src/python_src/paramiko-1.15.1.tar.gz

Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.1,!=2.4 in /usr/lib64/python2.6/site-packages (from paramiko==1.15.1)

Downloading/unpacking ecdsa>=0.11 (from paramiko==1.15.1)

  Cannot fetch index base URL https://pypi.python.org/simple/

  Could not find any downloads that satisfy the requirement ecdsa>=0.11 (from paramiko==1.15.1)

Cleaning up...

No distributions at all found for ecdsa>=0.11 (from paramiko==1.15.1)

Storing complete log in /root/.pip/pip.log

根据提示缺少ecdsa组件,需要先安装ecdsa组件之后再安装paramiko组件

pip install ecdsa-0.11.tar.gz

下载链接:https://pypi.python.org/pypi