尝试安装Python包时出现OpenSSL和Cryptography问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了尝试安装Python包时出现OpenSSL和Cryptography问题相关的知识,希望对你有一定的参考价值。

试图在python包上运行make dev并得到这个日志,任何想法?

Using cached futures-3.2.0-py2-none-any.whl
    Building wheels for collected packages: cryptography
      Running setup.py bdist_wheel for cryptography ... error
      Complete output from command /opt/h/.venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwPWQH/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpfQphoRpip-wheel- --python-tag cp27:
      running bdist_wheel
      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/__init__.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/exceptions.py -> build/lib.linux-x86_64-2.7/cryptography
      copying src/cryptography/__about__.py -> build/lib.linux-x86_64-2.7/cryptography
      copying src/cryptography/utils.py -> build/lib.linux-x86_64-2.7/cryptography
      creating 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/name.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/base.py -> build/lib.linux-x86_64-2.7/cryptography/x509
      copying src/cryptography/x509/extensions.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/primitives
      copying src/cryptography/hazmat/primitives/__init__.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/constant_time.py -> 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/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/keywrap.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
      creating 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
      copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
      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/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/algorithms.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/modes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
      creating 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/totp.py -> 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/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
      creating 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/kbkdf.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/hkdf.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
      copying src/cryptography/hazmat/primitives/kdf/scrypt.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
      creating 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/dh.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/dsa.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
      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/utils.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/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/decode_asn1.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/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/encode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/dh.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/ec.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/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/rsa.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
      creating 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
      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/backend.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/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
      creating 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
      copying src/cryptography/hazmat/bindings/openssl/binding.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/__init__.py -> 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
      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
      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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -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
      build/temp.linux-x86_64-2.7/_openssl.c:2:20: fatal error: Python.h: No such file or directory
      compilation terminated.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

      ----------------------------------------
      Failed building wheel for cryptography
      Running setup.py clean for cryptography
    Failed to build cryptography
    Installing collected packages: cryptography, zope.deprecation, peppercorn, deform, jinja2, deform-jinja2, urllib3, elasticsearch, functools32, greenlet, gevent, gunicorn, itsdangerous, jsonpointer, jsonschema, mistune, newrelic, oauthlib, passlib, pastedeploy, psycogreen, psycopg2, pyjwt, venusian, repoze.lru, webob, zope.interface, pyramid, pyramid-services, pyramid-authsanity, pyramid-jinja2, pyramid-layout, transaction, repoze.sendmail, pyramid-mailer, pyramid-tm, unidecode, python-slugify, raven, requests, requests-aws4auth, statsd, ws4py, wsaccel, zope.sqlalchemy, pyflakes, configparser, pycodestyle, mccabe, flake8, honcho, pep257, flake8-polyfill, pep8-naming, setoptconf, dodgy, wrapt, singledispatch, lazy-object-proxy, astroid, requirements-detector, futures, isort, pylint, pylint-plugin-utils, pylint-django, snowballstemmer, pydocstyle, pylint-celery, pylint-common, pyyaml, pylint-flask, docutils, pyroma, prospector, pyramid-mako, Pygments, pyramid-debugtoolbar, alabaster, babel, imagesize, typing, sphinxcontrib-websupport, sphinx, sphinx-rtd-theme
      Found existing installation: cryptography 2.1.4
        Uninstalling cryptography-2.1.4:
          Successfully uninstalled cryptography-2.1.4
      Running setup.py install for cryptography ... error
        Complete output from command /opt/h/.venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwPWQH/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-f6jEfJ-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/h/.venv/include/site/python2.7/cryptography:
        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/__init__.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/exceptions.py -> build/lib.linux-x86_64-2.7/cryptography
        copying src/cryptography/__about__.py -> build/lib.linux-x86_64-2.7/cryptography
        copying src/cryptography/utils.py -> build/lib.linux-x86_64-2.7/cryptography
        creating 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/name.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/base.py -> build/lib.linux-x86_64-2.7/cryptography/x509
        copying src/cryptography/x509/extensions.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/primitives
        copying src/cryptography/hazmat/primitives/__init__.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/constant_time.py -> 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/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/keywrap.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives
        creating 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
        copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends
        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/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/algorithms.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/modes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/ciphers
        creating 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/totp.py -> 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/utils.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/primitives/twofactor
        creating 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/kbkdf.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/hkdf.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
        copying src/cryptography/hazmat/primitives/kdf/scrypt.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
        creating 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/dh.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/dsa.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
        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/utils.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/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/decode_asn1.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/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/encode_asn1.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/openssl
        copying src/cryptography/hazmat/backends/openssl/dh.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/ec.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/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/rsa.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
        creating 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
        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/backend.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/hashes.py -> build/lib.linux-x86_64-2.7/cryptography/hazmat/backends/commoncrypto
        creating 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
        copying src/cryptography/hazmat/bindings/openssl/binding.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/__init__.py -> 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
        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
        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 -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -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
        build/temp.linux-x86_64-2.7/_openssl.c:2:20: fatal error: Python.h: No such file or directory
        compilation terminated.
        error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

        ----------------------------------------
      Rolling back uninstall of cryptography
    Command "/opt/h/.venv/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lwPWQH/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('
', '
');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-f6jEfJ-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/h/.venv/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-lwPWQH/cryptography/
    Makefile:68: recipe for target '.pydeps' failed
    make: *** [.pydeps] Error 1
答案

您缺少python标头(在基于debian的linux上安装相应的-dev软件包或在基于redhat的软件上安装-devel),或者构建过程在错误的位置搜索它们。在后一种情况下,要么纠正构建工具,要么使用各种CFLAGS变量覆盖标题搜索路径。

以上是关于尝试安装Python包时出现OpenSSL和Cryptography问题的主要内容,如果未能解决你的问题,请参考以下文章

使用 Ruby 1.9.3 时出现“证书验证失败”OpenSSL 错误

尝试运行 python 包时出现“RuntimeError: invalid slot offset”

Python - 安装新包时出现 ModuleNotFoundError

Gitlab Flask 页面:使用 .gitlab-ci.yml 文件为 Frozen Flask Application 安装 python GDAL 包时出现问题

在 azure 中创建 webjob 时出现 python 包安装错误

python安装大型包时出现错误Unable to find vcvarsall.bat