使用pip安装加密时出错

时间:2016-05-25 15:30:54

标签: python

当我尝试安装cryptography时,Ubuntu 14.04中的安装失败。除了基本的python安装之外,我已经尝试检查ubuntu方面是否有任何特殊要求,我还安装了以下要求。

"libxml2-dev",
"libxslt1-dev",
"lib32z1-dev",
"libffi-dev", #Requirement of cffi
"libssl-dev",

以下是它显示的错误。

   Running setup.py install for cryptography
     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'
     zip_safe flag not set; analyzing archive contents...

     Installed /tmp/pip_build_root/cryptography/pycparser-2.14-py2.7.egg

     no previously-included directories found matching 'docs/_build'
     warning: no previously-included files matching '*' found under directory 'vectors'
     generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'
     generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'
     generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
     building '_openssl' extension
     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/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
     x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)
     Please submit a full bug report,
     with preprocessed source if appropriate.
     See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
     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-VN5hsV-record/install-record.txt --single-version-externally-managed --compile:
     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'

 zip_safe flag not set; analyzing archive contents...



 Installed /tmp/pip_build_root/cryptography/pycparser-2.14-py2.7.egg

 running install

 running build

 running build_py

 creating build

 creating build/lib.linux-x86_64-2.7

 creating build/lib.linux-x86_64-2.7/cryptography

 copying src/cryptography/exceptions.py -> build/lib.linux-x86_64-2.7/cryptography

 copying src/cryptography/fernet.py -> build/lib.linux-x86_64-2.7/cryptography

 copying src/cryptography/__init__.py -> build/lib.linux-x86_64-2.7/cryptography

 copying src/cryptography/utils.py -> build/lib.linux-x86_64-2.7/cryptography

 copying src/cryptography/__about__.py -> build/lib.linux-x86_64-2.7/cryptography

 creating build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/extensions.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/oid.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/general_name.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/base.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 copying src/cryptography/x509/name.py -> build/lib.linux-x86_64-2.7/cryptography/x509

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat

 copying src/cryptography/hazmat/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings

 copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends

 copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends

 copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends

 copying src/cryptography/hazmat/backends/multibackend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/serialization.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl

 copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl

 copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl

 copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/openssl

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto

 copying src/cryptography/hazmat/bindings/commoncrypto/binding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto

 copying src/cryptography/hazmat/bindings/commoncrypto/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/bindings/commoncrypto

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 copying src/cryptography/hazmat/backends/commoncrypto/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 copying src/cryptography/hazmat/backends/commoncrypto/hmac.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 copying src/cryptography/hazmat/backends/commoncrypto/ciphers.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 copying src/cryptography/hazmat/backends/commoncrypto/backend.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 copying src/cryptography/hazmat/backends/commoncrypto/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers

 copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers

 copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers

 copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers

 copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/kdf

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/asymmetric

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/interfaces

 copying src/cryptography/hazmat/primitives/interfaces/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/interfaces

 creating build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor

 copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor

 copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor

 copying src/cryptography/hazmat/primitives/twofactor/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor

 copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor

 running egg_info

 writing requirements to src/cryptography.egg-info/requires.txt

 writing src/cryptography.egg-info/PKG-INFO

 writing top-level names to src/cryptography.egg-info/top_level.txt

 writing dependency_links to src/cryptography.egg-info/dependency_links.txt

 writing entry points to src/cryptography.egg-info/entry_points.txt

 warning: manifest_maker: standard file '-c' not found



 reading manifest file 'src/cryptography.egg-info/SOURCES.txt'

 reading manifest template 'MANIFEST.in'

 no previously-included directories found matching 'docs/_build'

 warning: no previously-included files matching '*' found under directory 'vectors'

 writing manifest file 'src/cryptography.egg-info/SOURCES.txt'

 running build_ext

 generating cffi module 'build/temp.linux-x86_64-2.7/_padding.c'

 creating build/temp.linux-x86_64-2.7

 generating cffi module 'build/temp.linux-x86_64-2.7/_constant_time.c'

 generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'

 building '_openssl' extension

 creating build/temp.linux-x86_64-2.7/build

 creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7

 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/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o

 x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1)

 Please submit a full bug report,

 with preprocessed source if appropriate.

 See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

 error: command 'x86_64-linux-gnu-gcc' failed with exit status 4

 ----------------------------------------
 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-VN5hsV-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 个答案:

答案 0 :(得分:3)

我找到了答案,因为服务器资源不足而导致此错误。

我需要更多ram或更大的交换文件才能使命令成功。

类似问题:lxml installation error ubuntu 14.04 (internal compiler error)

我做了什么:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

然后pip install cryptography。为我工作。 :)