使用 pip 安装 ansible 失败

使用 pip 安装 ansible 失败

我尝试使用以下命令安装 ansible:

docker run -ti --rm ubuntu:14.04 bash
echo "===> Updating cache..." && \
    apt-get update && \
    \
    \    
    echo "===> Installing sudo..."  && \
    apt-get install -y  sudo && \
    \
    \
    apt-get install python-pip python-dev -y && \
    apt-get install python-apt -y -q && \
    \
    \
    echo "===> Installing Ansible 2.1.0.0..." && \
    pip install --upgrade ansible==2.1.0.0

但它失败了:

root@4a0497d1c873:/# pip install --upgrade ansible==2.1.0.0
Downloading/unpacking ansible==2.1.0.0
  Downloading ansible-2.1.0.0.tar.gz (1.9MB): 1.9MB downloaded
  Running setup.py (path:/tmp/pip_build_root/ansible/setup.py) egg_info for package ansible

    no previously-included directories found matching 'v2'
    no previously-included directories found matching 'docsite'
    no previously-included directories found matching 'ticket_stubs'
    no previously-included directories found matching 'packaging'
    no previously-included directories found matching 'test'
    no previously-included directories found matching 'hacking'
    warning: no previously-included files found matching 'lib/ansible/modules/core/.git*'
    warning: no previously-included files found matching 'lib/ansible/modules/extras/.git*'
    no previously-included directories found matching 'lib/ansible/modules/core/.git'
    no previously-included directories found matching 'lib/ansible/modules/extras/.git'
Downloading/unpacking paramiko (from ansible==2.1.0.0)
  Downloading paramiko-2.0.1-py2.py3-none-any.whl (171kB): 171kB downloaded
Downloading/unpacking jinja2 (from ansible==2.1.0.0)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB): 263kB downloaded
Downloading/unpacking PyYAML (from ansible==2.1.0.0)
  Downloading PyYAML-3.11.zip (371kB): 371kB downloaded
  Running setup.py (path:/tmp/pip_build_root/PyYAML/setup.py) egg_info for package PyYAML

Downloading/unpacking setuptools from https://pypi.python.org/packages/d7/3d/577bafbfc9fcd78ed7b45de24a6bc30a94cc75cbde786389f1014d433614/setuptools-23.1.0-py2.py3-none-any.whl#md5=bdffb519c49d6bf3aae47f8f1a6ea3b5 (from ansible==2.1.0.0)
  Downloading setuptools-23.1.0-py2.py3-none-any.whl (435kB): 435kB downloaded
Downloading/unpacking pycrypto>=2.6 (from ansible==2.1.0.0)
  Downloading pycrypto-2.6.1.tar.gz (446kB): 446kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pycrypto/setup.py) egg_info for package pycrypto

Downloading/unpacking pyasn1>=0.1.7 (from paramiko->ansible==2.1.0.0)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Downloading/unpacking cryptography>=1.1 (from paramiko->ansible==2.1.0.0)
  Downloading cryptography-1.4.tar.gz (399kB): 399kB downloaded
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography

    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
Downloading/unpacking MarkupSafe (from jinja2->ansible==2.1.0.0)
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py (path:/tmp/pip_build_root/MarkupSafe/setup.py) egg_info for package MarkupSafe

Downloading/unpacking idna>=2.0 (from cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB): 54kB downloaded
Downloading/unpacking six>=1.4.1 from https://pypi.python.org/packages/c8/0a/b6723e1bc4c516cb687841499455a8505b44607ab535be01091c0f24f079/six-1.10.0-py2.py3-none-any.whl#md5=3ab558cf5d4f7a72611d59a81a315dc8 (from cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading six-1.10.0-py2.py3-none-any.whl
Downloading/unpacking enum34 (from cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading enum34-1.1.6-py2-none-any.whl
Downloading/unpacking ipaddress (from cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading ipaddress-1.0.16-py27-none-any.whl
Downloading/unpacking cffi>=1.4.1 (from cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading cffi-1.7.0.tar.gz (400kB): 400kB downloaded
  Running setup.py (path:/tmp/pip_build_root/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pycparser (from cffi>=1.4.1->cryptography>=1.1->paramiko->ansible==2.1.0.0)
  Downloading pycparser-2.14.tar.gz (223kB): 223kB downloaded
  Running setup.py (path:/tmp/pip_build_root/pycparser/setup.py) egg_info for package pycparser

    warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
    warning: no previously-included files matching 'lextab.*' found under directory 'tests'
    warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
    warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: ansible, paramiko, jinja2, PyYAML, setuptools, pycrypto, pyasn1, cryptography, MarkupSafe, idna, six, enum34, ipaddress, cffi, pycparser
  Running setup.py install for ansible
    changing mode of build/scripts-2.7/ansible from 644 to 755
    changing mode of build/scripts-2.7/ansible-playbook from 644 to 755
    changing mode of build/scripts-2.7/ansible-pull from 644 to 755
    changing mode of build/scripts-2.7/ansible-doc from 644 to 755
    changing mode of build/scripts-2.7/ansible-galaxy from 644 to 755
    changing mode of build/scripts-2.7/ansible-console from 644 to 755
    changing mode of build/scripts-2.7/ansible-vault from 644 to 755

    no previously-included directories found matching 'v2'
    no previously-included directories found matching 'docsite'
    no previously-included directories found matching 'ticket_stubs'
    no previously-included directories found matching 'test'
    no previously-included directories found matching 'hacking'
    warning: no previously-included files found matching 'lib/ansible/modules/core/.git*'
    warning: no previously-included files found matching 'lib/ansible/modules/extras/.git*'
    no previously-included directories found matching 'lib/ansible/modules/core/.git'
    no previously-included directories found matching 'lib/ansible/modules/extras/.git'
    changing mode of /usr/local/bin/ansible-console to 755
    changing mode of /usr/local/bin/ansible-vault to 755
    changing mode of /usr/local/bin/ansible-pull to 755
    changing mode of /usr/local/bin/ansible-doc to 755
    changing mode of /usr/local/bin/ansible to 755
    changing mode of /usr/local/bin/ansible-playbook to 755
    changing mode of /usr/local/bin/ansible-galaxy to 755
  Running setup.py install for PyYAML
    checking if libyaml is compilable
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
    build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory
     #include <yaml.h>
                      ^
    compilation terminated.

    libyaml is not found or a compiler error: forcing --without-libyaml
    (if libyaml is installed correctly, you may need to
     specify the option --include-dirs or uncomment and
     modify the parameter include_dirs in setup.cfg)

  Found existing installation: setuptools 3.3
    Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for pycrypto
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for __gmpz_init in -lgmp... no
    checking for __gmpz_init in -lmpir... no
    checking whether mpz_powm is declared... no
    checking whether mpz_powm_sec is declared... no
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for inttypes.h... (cached) yes
    checking limits.h usability... yes
    checking limits.h presence... yes
    checking for limits.h... yes
    checking stddef.h usability... yes
    checking stddef.h presence... yes
    checking for stddef.h... yes
    checking for stdint.h... (cached) yes
    checking for stdlib.h... (cached) yes
    checking for string.h... (cached) yes
    checking wchar.h usability... yes
    checking wchar.h presence... yes
    checking for wchar.h... yes
    checking for inline... inline
    checking for int16_t... yes
    checking for int32_t... yes
    checking for int64_t... yes
    checking for int8_t... yes
    checking for size_t... yes
    checking for uint16_t... yes
    checking for uint32_t... yes
    checking for uint64_t... yes
    checking for uint8_t... yes
    checking for stdlib.h... (cached) yes
    checking for GNU libc compatible malloc... yes
    checking for memmove... yes
    checking for memset... yes
    configure: creating ./config.status
    config.status: creating src/config.h
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Hash._MD2' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-x86_64-2.7/src/MD2.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/MD2.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_MD2.so
    building 'Crypto.Hash._MD4' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD4.c -o build/temp.linux-x86_64-2.7/src/MD4.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/MD4.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_MD4.so
    building 'Crypto.Hash._SHA256' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/SHA256.c -o build/temp.linux-x86_64-2.7/src/SHA256.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/SHA256.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_SHA256.so
    building 'Crypto.Hash._SHA224' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/SHA224.c -o build/temp.linux-x86_64-2.7/src/SHA224.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/SHA224.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_SHA224.so
    building 'Crypto.Hash._SHA384' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/SHA384.c -o build/temp.linux-x86_64-2.7/src/SHA384.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/SHA384.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_SHA384.so
    building 'Crypto.Hash._SHA512' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/SHA512.c -o build/temp.linux-x86_64-2.7/src/SHA512.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/SHA512.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_SHA512.so
    building 'Crypto.Hash._RIPEMD160' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -DPCT_LITTLE_ENDIAN=1 -Isrc/ -I/usr/include/python2.7 -c src/RIPEMD160.c -o build/temp.linux-x86_64-2.7/src/RIPEMD160.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/RIPEMD160.o -o build/lib.linux-x86_64-2.7/Crypto/Hash/_RIPEMD160.so
    building 'Crypto.Cipher._AES' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/AES.c -o build/temp.linux-x86_64-2.7/src/AES.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/AES.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_AES.so
    building 'Crypto.Cipher._ARC2' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/ARC2.c -o build/temp.linux-x86_64-2.7/src/ARC2.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/ARC2.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_ARC2.so
    building 'Crypto.Cipher._Blowfish' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/Blowfish.c -o build/temp.linux-x86_64-2.7/src/Blowfish.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/Blowfish.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_Blowfish.so
    building 'Crypto.Cipher._CAST' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/CAST.c -o build/temp.linux-x86_64-2.7/src/CAST.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/CAST.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_CAST.so
    building 'Crypto.Cipher._DES' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -Isrc/libtom/ -I/usr/include/python2.7 -c src/DES.c -o build/temp.linux-x86_64-2.7/src/DES.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/DES.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_DES.so
    building 'Crypto.Cipher._DES3' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -Isrc/libtom/ -I/usr/include/python2.7 -c src/DES3.c -o build/temp.linux-x86_64-2.7/src/DES3.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/DES3.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_DES3.so
    building 'Crypto.Cipher._ARC4' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/ARC4.c -o build/temp.linux-x86_64-2.7/src/ARC4.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/ARC4.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_ARC4.so
    building 'Crypto.Cipher._XOR' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/XOR.c -o build/temp.linux-x86_64-2.7/src/XOR.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/XOR.o -o build/lib.linux-x86_64-2.7/Crypto/Cipher/_XOR.so
    building 'Crypto.Util.strxor' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/strxor.c -o build/temp.linux-x86_64-2.7/src/strxor.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/strxor.o -o build/lib.linux-x86_64-2.7/Crypto/Util/strxor.so
    building 'Crypto.Util._counter' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/_counter.c -o build/temp.linux-x86_64-2.7/src/_counter.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_counter.o -o build/lib.linux-x86_64-2.7/Crypto/Util/_counter.so

  Could not find .egg-info directory in install record for pycrypto>=2.6 (from ansible==2.1.0.0)
  Running setup.py install for cryptography
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_root/cryptography/setup.py", line 333, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 269, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 313, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 826, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1092, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1104, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 380, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 664, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 694, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 875, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1114, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1102, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xpy1qu-record/install-record.txt --single-version-externally-managed --compile:
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

 #include <ffi.h>

                 ^

compilation terminated.

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/cryptography/setup.py", line 333, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 269, in __init__

    self.fetch_build_eggs(attrs['setup_requires'])

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 313, in fetch_build_eggs

    replace_conflicting=True,

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 826, in resolve

    dist = best[req.key] = env.best_match(req, ws, installer)

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1092, in best_match

    return self.obtain(req, installer)

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1104, in obtain

    return installer(requirement)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 380, in fetch_build_egg

    return cmd.easy_install(req)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 664, in easy_install

    return self.install_item(spec, dist.location, tmpdir, deps)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 694, in install_item

    dists = self.install_eggs(spec, download, tmpdir)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 875, in install_eggs

    return self.build_and_install(setup_script, setup_base)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1114, in build_and_install

    self.run_setup(setup_script, setup_base, args)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1102, in run_setup

    raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xpy1qu-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

答案1

在 ubuntu 上安装 ansible 的推荐方法是通过其 ppa:

sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible

http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-apt-ubuntu

这将处理所有依赖关系,并且比 ziky 的答案更具前瞻性。

答案2

从你的输出

c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
build/temp.linux-x86_64-2.7/check_libyaml.c:2:18: fatal error: yaml.h: No such file or directory

似乎你没有libffi安装libyaml。尝试

sudo apt-get install libffi-dev
sudo apt-get install libyaml-dev

相关内容