标签归档:cryptography

无法使用PIP和setup.py安装Python密码术软件包

问题:无法使用PIP和setup.py安装Python密码术软件包

当我尝试通过安装Python 加密程序包pip install cryptography或通过从其站点下载该程序包并运行时python setup.py,出现以下错误:


D:\Anaconda\Scripts\pip-script.py run on 02/27/14 16:13:17
Downloading/unpacking cryptography
  Getting page https://pypi.python.org/simple/cryptography/
  URLs to search for versions for cryptography:
  * https://pypi.python.org/simple/cryptography/
  Analyzing links from page https://pypi.python.org/simple/cryptography/
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2-cp26-none-win32.whl#md5=13e5c4b19520e7dc6f07c6502b3f74e2 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2.1-cp26-none-win32.whl#md5=00e733648ee5cdb9e58876238b1328f8 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2-cp27-none-win32.whl#md5=013ccafa6a5a3ea92c73f2c1c4879406 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2.1-cp27-none-win32.whl#md5=127d6a5dc687250721f892d55720a06c (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2-cp32-none-win32.whl#md5=051424a36e91039807b72f112333ded3 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2.1-cp32-none-win32.whl#md5=53f6f57db8e952d64283baaa14cbde3d (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2-cp33-none-win32.whl#md5=302812c1c1a035cf9ba3292f8dbf3f9e (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2.1-cp33-none-win32.whl#md5=81acca90caf8a45f2ca73f3f9859fae4 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.1.tar.gz#md5=bdc1c5fe069deca7467b71a0cc538f17 (from https://pypi.python.org/simple/cryptography/), version: 0.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/), version: 0.2.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.tar.gz#md5=8a3d21e837a21e1b7634ee1f22b06bb6 (from https://pypi.python.org/simple/cryptography/), version: 0.2
  Using version 0.2.1 (newest of versions: 0.2.1, 0.2, 0.1)
  Downloading from URL https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/)
  Running setup.py (path:c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py) egg_info for package cryptography
    In file included from c/_cffi_backend.c:7:0:
    c/misc_win32.h:225:23: error: two or more data types in declaration specifiers
    c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]
    c/_cffi_backend.c: In function 'convert_array_from_object':
    c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'convert_struct_from_object':
    c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_repr':
    c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]
    c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdataowning_repr':
    c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_getslicearg':
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_ass_slice':
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_call':
    c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cast_to_integer_or_char':
    c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'new_array_type':
    c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]
    c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'b_complete_struct_or_union':
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>
        "build": cffi_build,
      File "D:\Anaconda\lib\distutils\core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match
        return self.obtain(req, installer) # try and download/install
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain
        return installer(requirement)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg
      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup

    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    In file included from c/_cffi_backend.c:7:0:

c/misc_win32.h:225:23: error: two or more data types in declaration specifiers

c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]

c/_cffi_backend.c: In function 'convert_array_from_object':

c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'convert_struct_from_object':

c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_repr':

c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]

c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdataowning_repr':

c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_getslicearg':

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_ass_slice':

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_call':

c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cast_to_integer_or_char':

c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'new_array_type':

c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]

c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'b_complete_struct_or_union':

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]

Traceback (most recent call last):

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

  File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>

    "build": cffi_build,

  File "D:\Anaconda\lib\distutils\core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve

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

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match

    return self.obtain(req, installer) # try and download/install

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain

    return installer(requirement)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg

  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup



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

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\paco\appdata\local\temp\pip_build_Paco...
Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography
Exception information:
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography

我发现了其他egg_info错误帖子(此处此处),但是那里提供的解决方案无法解决我的问题。另外,我能够通过PIP安装其他软件包。

PIP版本1.5.4 setuptools版本2.2

When I try to install the Cryptography package for Python through either pip install cryptography or by downloading the package from their site and running python setup.py, I get the following error:


D:\Anaconda\Scripts\pip-script.py run on 02/27/14 16:13:17
Downloading/unpacking cryptography
  Getting page https://pypi.python.org/simple/cryptography/
  URLs to search for versions for cryptography:
  * https://pypi.python.org/simple/cryptography/
  Analyzing links from page https://pypi.python.org/simple/cryptography/
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2-cp26-none-win32.whl#md5=13e5c4b19520e7dc6f07c6502b3f74e2 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2.1-cp26-none-win32.whl#md5=00e733648ee5cdb9e58876238b1328f8 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2-cp27-none-win32.whl#md5=013ccafa6a5a3ea92c73f2c1c4879406 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2.1-cp27-none-win32.whl#md5=127d6a5dc687250721f892d55720a06c (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2-cp32-none-win32.whl#md5=051424a36e91039807b72f112333ded3 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2.1-cp32-none-win32.whl#md5=53f6f57db8e952d64283baaa14cbde3d (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2-cp33-none-win32.whl#md5=302812c1c1a035cf9ba3292f8dbf3f9e (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2.1-cp33-none-win32.whl#md5=81acca90caf8a45f2ca73f3f9859fae4 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.1.tar.gz#md5=bdc1c5fe069deca7467b71a0cc538f17 (from https://pypi.python.org/simple/cryptography/), version: 0.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/), version: 0.2.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.tar.gz#md5=8a3d21e837a21e1b7634ee1f22b06bb6 (from https://pypi.python.org/simple/cryptography/), version: 0.2
  Using version 0.2.1 (newest of versions: 0.2.1, 0.2, 0.1)
  Downloading from URL https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/)
  Running setup.py (path:c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py) egg_info for package cryptography
    In file included from c/_cffi_backend.c:7:0:
    c/misc_win32.h:225:23: error: two or more data types in declaration specifiers
    c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]
    c/_cffi_backend.c: In function 'convert_array_from_object':
    c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'convert_struct_from_object':
    c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_repr':
    c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]
    c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdataowning_repr':
    c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_getslicearg':
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_ass_slice':
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_call':
    c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cast_to_integer_or_char':
    c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'new_array_type':
    c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]
    c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'b_complete_struct_or_union':
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>
        "build": cffi_build,
      File "D:\Anaconda\lib\distutils\core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match
        return self.obtain(req, installer) # try and download/install
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain
        return installer(requirement)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg
      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup

    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    In file included from c/_cffi_backend.c:7:0:

c/misc_win32.h:225:23: error: two or more data types in declaration specifiers

c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]

c/_cffi_backend.c: In function 'convert_array_from_object':

c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'convert_struct_from_object':

c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_repr':

c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]

c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdataowning_repr':

c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_getslicearg':

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_ass_slice':

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_call':

c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cast_to_integer_or_char':

c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'new_array_type':

c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]

c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'b_complete_struct_or_union':

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]

Traceback (most recent call last):

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

  File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>

    "build": cffi_build,

  File "D:\Anaconda\lib\distutils\core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve

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

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match

    return self.obtain(req, installer) # try and download/install

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain

    return installer(requirement)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg

  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup



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

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\paco\appdata\local\temp\pip_build_Paco...
Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography
Exception information:
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography

I found other egg_info error posts (here and here) but the solutions there provided wouldn’t solve my problem. Also, I am able to install other packages through PIP.

PIP version 1.5.4 setuptools version 2.2


回答 0

我有一个类似的问题,发现我只是缺少一个依赖项(对我来说是libssl-dev)。如https://cryptography.io/en/latest/installation/中所述,确保满足所有依赖关系:

在Windows上

如果您使用的是Windows,则需要确保已安装OpenSSL。有可用的预编译二进制文件。如果您的安装位置不正常,请设置LIB和INCLUDE环境变量以包括相应的位置。例如:

C:\> \path\to\vcvarsall.bat x86_amd64
C:\> set LIB=C:\OpenSSL-1.0.1f-64bit\lib;%LIB%
C:\> set INCLUDE=C:\OpenSSL-1.0.1f-64bit\include;%INCLUDE%
C:\> pip install cryptography

在Linux上构建加密

如果您具有C编译器,Python的标头(如果您未使用pypy)以及系统上可用的OpenSSL和libffi库的标头,则加密技术在Linux上应该可以轻松构建。

对于Debian和Ubuntu,以下命令将确保已安装必需的依赖项:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

对于Fedora和RHEL衍生物,以下命令将确保已安装必需的依赖项:

sudo yum install gcc libffi-devel python-devel OpenSSL-devel

现在,您应该可以使用通常的方法来构建和安装加密了。

pip install cryptography

I had a similar issue, and found I was simply missing a dependency (libssl-dev, for me). As referenced in https://cryptography.io/en/latest/installation/, ensure that all dependencies are met:

On Windows

If you’re on Windows you’ll need to make sure you have OpenSSL installed. There are pre-compiled binaries available. If your installation is in an unusual location set the LIB and INCLUDE environment variables to include the corresponding locations. For example:

C:\> \path\to\vcvarsall.bat x86_amd64
C:\> set LIB=C:\OpenSSL-1.0.1f-64bit\lib;%LIB%
C:\> set INCLUDE=C:\OpenSSL-1.0.1f-64bit\include;%INCLUDE%
C:\> pip install cryptography

Building cryptography on Linux

cryptography should build very easily on Linux provided you have a C compiler, headers for Python (if you’re not using pypy), and headers for the OpenSSL and libffi libraries available on your system.

For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

For Fedora and RHEL-derivatives, the following command will ensure that the required dependencies are installed:

sudo yum install gcc libffi-devel python-devel OpenSSL-devel

You should now be able to build and install cryptography with the usual.

pip install cryptography

回答 1

这是在加密技术的安装文档页面上找到的信息的精简版本。请查阅该页面以获取最新详细信息。

由于这个SO问题不断出现,因此我也将在此处做出回应(我是pyca / cryptography开发人员之一)。这是在3个主要平台上可靠地安装pyca / cryptography所需要的。

请注意,在所有这些情况下,强烈建议您安装到virtualenv中,而不要安装到全局软件包空间中。这并非特定于密码学,而是通用建议,以确保您的Python安装可靠。如果Python归系统所有,则OS中的全局程序包空间由系统拥有,并且通过pip进行安装会带来麻烦。

视窗

升级到最新的点(截至2016年6月为8.1.2) pip install cryptography

加密和cffi都作为静态链接的轮子提供。

OS X

升级到最新的点(截至2016年6月为8.1.2) pip install cryptography

加密和cffi都作为静态链接的轮子提供。这将适用于pyenv Python,系统Python,自制Python等。只要您使用的是最新的pip,您甚至都不需要编译器。

的Linux

从2.0版开始,密码学附带了许多Linux1轮子。这意味着在基于glibc的发行版(除Alpine Linux之外几乎所有产品)和x86 / x86-64(对不起的Raspberry Pi使用者)上运行pip 8.1+的用户不再需要编译器或标头,因为您将自动获得预编译的转轮。因此,您应该尝试的第一件事就是升级您的点数!

如果您与manylinux1不兼容,那么您需要执行以下操作:

您将需要一个C编译器,libffi及其开发标头,以及openssl及其开发标头。

Debian或Ubuntu衍生发行版

apt-get install build-essential libssl-dev libffi-dev python-dev 其次是

pip install cryptography

红帽衍生发行版

yum install gcc openssl-devel libffi-devel python-devel 其次是

pip install cryptography

This is a condensed version of the information found on cryptography’s installation docs page. Consult that page for the latest details.

Since this SO question keeps coming up I’ll drop a response here too (I am one of the pyca/cryptography developers). Here’s what you need to reliably install pyca/cryptography on the 3 major platforms.

Please note in all these cases it is highly recommended that you install into a virtualenv and not into the global package space. This is not specific to cryptography but rather is generic advice to keep your Python installation reliable. The global package space in OS provided Pythons is owned by the system and installing things via pip into it is asking for trouble.

Windows

Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography

cryptography and cffi are both shipped as statically linked wheels.

OS X

Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography

cryptography and cffi are both shipped as statically linked wheels. This will work for pyenv Python, system Python, homebrew Python, etc. As long as you’re on the latest pip you won’t even need a compiler.

Linux

As of version 2.0 cryptography ships manylinux wheels. This means users with pip 8.1+ running on a glibc-based distribution (almost everything except Alpine Linux) and on x86/x86-64 no longer need a compiler or headers because you’ll get a precompiled wheel automatically. With version 3.1 we now also ship aarch64 wheels (which require a very recent pip…20.0+). So, first thing you should try is upgrading your pip!

If you aren’t manylinux compatible then here’s what you need to do:

You’ll need a C compiler, libffi + its development headers, and openssl + its development headers.

Debian or Ubuntu derived distributions

apt-get install build-essential libssl-dev libffi-dev python-dev followed by

pip install cryptography

Red Hat derived distributions

yum install gcc openssl-devel libffi-devel python-devel followed by

pip install cryptography


回答 2

对于那些运行OS X的人来说,这对我有用:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include"
pip install cryptography

(运行10.9小牛)

您可能还想根据下面的注释尝试将flags和pip命令合并到以下内容:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography

For those of you running OS X, here is what worked for me:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include"
pip install cryptography

(Running 10.9 Mavericks)

You may also want to try merging the flags and pip commands to the following per the comment below:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography

回答 3

这在El Capitan对我有用

brew install pkg-config libffi openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

您还可以在此处检查线程:https : //github.com/pyca/cryptography/issues/2350

This worked for me in El Capitan

brew install pkg-config libffi openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

You can also check the thread here : https://github.com/pyca/cryptography/issues/2350


回答 4

这为我解决了问题(Ubuntu 16.04):

sudo apt-get install build-essential libssl-dev libffi-dev python-dev python3-dev

然后它像这样工作:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

This solved the problem for me (Ubuntu 16.04):

sudo apt-get install build-essential libssl-dev libffi-dev python-dev python3-dev

and then it was working like this:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

回答 5

显然,在OSX的最新版本中,这可能是由于Apple发行了自己的OpenSSL版本而导致的,该版本不适用于加密库。

加密库的最新版本附带了它们自己的本机依赖性,但是要获取它们,您需要升级pip,还可能需要升级虚拟环境。所以对我来说,解决方案是:

pip install --upgrade --force-reinstall pip virtualenv

Apparently on recent versions of OSX this may be caused by Apple shipping their own version of OpenSSL, which doesn’t work with the cryptography library.

Recent versions of the cryptography library ship with their own native dependencies, but to get them you’ll need to upgrade pip, and possibly also virtual env. So for me, the solution was:

pip install --upgrade --force-reinstall pip virtualenv

回答 6

我如何解决“无法清除用于加密的生成目录”
(我从Google来到这里是导致此错误的结果。)

注意:使用virtualenv

TL; DR:

我的/etc/apt/sources.listDebian 8没有正确配置我的文件。

说明:

我想安装paramiko。paramiko需要加密。

我遇到了以下错误:首先出现pip install cryptography

(...)
  ----------------------------------------
  Failed cleaning build dir for cryptography
Failed to build cryptography
(...)
    ----------------------------------------
Command "/home/myuser/pyenvs/testo/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-HXWKAO/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-WjqY6V-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/myuser/pyenvs/testo/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-HXWKAO/cryptography/

然后用sudo apt-get install build-essential

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed > or
                            libc-dev
                   Depends: gcc (>= 4:4.4.3) but it is not going to be installed
                   Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

(与OP错误并不完全相同,但最终我会为您提供帮助)

解决方法:

在测试完每个帖子的几乎所有命令之后,我最终进入
https://wiki.debian.org/SourcesList
并将其适当的配置复制粘贴到文件中/etc/apt/sources.list

然后:

sudo aptitude update

然后

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

然后

pip install cryptography

hth

How I solved “Failed cleaning build dir for cryptography”
(I came here from google to result for this error.)

note: using a virtualenv

TL;DR:

my file /etc/apt/sources.list wasn’t correctly configured for my debian 8.

Explanations:

I wanted to install paramiko. paramiko needs cryptography.

I got these errors: first with pip install cryptography:

(...)
  ----------------------------------------
  Failed cleaning build dir for cryptography
Failed to build cryptography
(...)
    ----------------------------------------
Command "/home/myuser/pyenvs/testo/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-HXWKAO/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-WjqY6V-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/myuser/pyenvs/testo/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-HXWKAO/cryptography/

and then with sudo apt-get install build-essential :

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed > or
                            libc-dev
                   Depends: gcc (>= 4:4.4.3) but it is not going to be installed
                   Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

(Not exactly the same errors as OP but I’m here to help eventually)

Solving:

After testing almost every command from every posts I end up going on
https://wiki.debian.org/SourcesList
and copy pasted my adequate config in the file /etc/apt/sources.list

then:

sudo aptitude update

and then

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

and then

pip install cryptography

hth


回答 7

我在上面尝试了许多解决方案,但是只有在安装以下lib之后,我才能安装cryptography

sudo apt install libssl1.0

我正在使用Ubuntu 18.04,但它也可以在Ubuntu 18.10上运行。

I tried many solutions above, but only after the installation of the following lib I could install cryptography:

sudo apt install libssl1.0

I’m using Ubuntu 18.04, but it will work on Ubuntu 18.10 as well.

UPD: To solve this error on Ubuntu 20 I had to replace cryptography==1.9 with cryptography==2.1.1


回答 8

这对我有用(我正在使用Ubuntu 14.04):

首先安装libffi-dev libssl-dev libpython2.7-dev:

sudo apt-get install libffi-dev libssl-dev libpython2.7-dev

然后在virtualenv内部:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

资料来源:

https://stackoverflow.com/a/32800685/5123544

https://stackoverflow.com/a/29202163/5123544

This worked for me (I’m using Ubuntu 14.04):

first install libffi-dev libssl-dev libpython2.7-dev:

sudo apt-get install libffi-dev libssl-dev libpython2.7-dev

then inside virtualenv:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

Sources:

https://stackoverflow.com/a/32800685/5123544

https://stackoverflow.com/a/29202163/5123544


回答 9

Nick Woodham的答案对我来说不适用于OSX 10.11 El Capitan,但确实如此。

brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8

Nick Woodham’s answer didn’t work on OSX 10.11 El Capitan for me, but this did.

brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8

回答 10

如果您使用的是python3,则需要安装python3-dev。这解决了我的问题sudo apt-get install python3-dev

If you are using python3, you need to install python3-dev. This fixed my problem sudo apt-get install python3-dev.


回答 11

cryptography==1.7.1在Ubuntu 16.04 上安装时遇到问题,以上答案均无济于事。因此,我将需求升级到兼容的1.8.2,安装成功。请注意,您仍将需要在top(最不推荐)答案中提到的构建要素和其他依赖项。

I was having issues with installing cryptography==1.7.1 on Ubuntu 16.04 and none of the answers above helped. So, I upgraded the requirement to a compatible 1.8.2 and the setup was successful. Note that you would still need build essentials & other dependencies mentioned in the top (most upvoted) answer.


回答 12

我在运行时遇到问题,sudo pip install cryptography因为在尝试编译时找不到ffi。(OSX-优胜美地)

我通过下载libffi并设置env var来解决它。

$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography

I was having a problem running sudo pip install cryptography because it would not find ffi when trying to compile. (OSX – Yosemite)

I solved it by downloading libffi and setting up the env var.

$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography

回答 13

可以在MacPorts的El Capitan上使用:

$ sudo port install openssl
$ env LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography

This works on El Capitan with MacPorts:

$ sudo port install openssl
$ env LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography

回答 14

如果要在GitLab CI.gitlab-ci.yml文件中构建python软件包分发,该文件使用部署在AWS EC2机器中的gitlab运行器

 - apk add --update alpine-sdk && \
 - apk add libffi-dev openssl-dev && \
 - apk --no-cache --update add build-base

If you are building a python package distribution in a .gitlab-ci.yml file in for GitLab CI that uses a gitlab runner deployed in an AWS EC2 machine

 - apk add --update alpine-sdk && \
 - apk add libffi-dev openssl-dev && \
 - apk --no-cache --update add build-base

回答 15

我注意到原始海报显然是使用Windows安装的…上面的最佳答案都是针对其他操作系统的…所以去了。假设您已经安装了python 2.7,这是最广泛支持(尽管是旧的)的版本。

  1. 安装“适用于Python的Visual C ++编译器
  2. 打开管理命令提示窗口
  3. 重新运行pip安装(程序包),例如

    cd C:\Python27\Scripts
    pip install cryptography  (or pycrypto, fabric, etc)

I noticed the original poster was clearly using a windows installation… and the best answers above are all for other OSs… so here goes. This assumes you have installed Python 2.7 which is the most widely supported (though old) version.

  1. Install the “Visual C++ Compiler for Python
  2. Open an Administrative command prompt window
  3. Re-run pip install (package) e.g.

    cd C:\Python27\Scripts
    pip install cryptography  (or pycrypto, fabric, etc)
    

回答 16

我最近遇到了类似的问题。就我而言,requirements.txt中的版本cfficryptography写入的版本不兼容(cffi == 1.8.9和cryptography == 1.9)。我解决cffi了使用最新可用版本进行更新的问题。

I encountered a similar issue recently. In my case the versions of cffi and cryptography written in requirements.txt weren’t compatible (cffi==1.8.9 and cryptography==1.9). I solved updating cffi with the last available version.


回答 17

我实际上遇到了同样的问题,试图安装Scrapy,这取决于首先安装的加密技术。我使用的是Win764位,安装了Python 2.7 64位。@jsonm的答案最终对我有用,但首先我必须复制C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.bat到该x86_amd64bin目录中的子目录,以便vcvarsall.bat才会停止抛出错误,指出它缺少配置。如果您需要为其他设置配置环境变量,请确保将相应的vcvars bat文件复制到相应的子目录,否则下面的第一个命令可能不起作用。

然后我按照@jsonm的说明(针对我的配置进行了调整)从命令行运行了以下内容…

C:\> "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64 
C:\> set LIB=C:\OpenSSL-Win64\lib;%LIB% 
C:\> set INCLUDE=C:\OpenSSL-Win64\include;%INCLUDE% 
C:\> pip install cryptography

而且有效。

I actually ran into this same prob trying to install Scrapy which depends on cryptography being installed first. I’m on Win764-bit with Python 2.7 64-bit installed. @jsonm’s answer eventually worked for me, but first I had to Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.bat to the x86_amd64 subdir within that bin dir so the vcvarsall.bat would stop throwing an error saying it was missing the config. If you need to configure env vars for a different setup, be sure to copy to corresponding vcvars bat file to the corresponding subdir or the first command below might not work.

Then I ran the following from a commandline as per @jsonm’s instructions (tweaked for my config)…

C:\> "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64 
C:\> set LIB=C:\OpenSSL-Win64\lib;%LIB% 
C:\> set INCLUDE=C:\OpenSSL-Win64\include;%INCLUDE% 
C:\> pip install cryptography

And it worked.


回答 18

我也有这个错误。甚至在安装openSSL之后仍然出现此错误之后,我最终尝试从https://pypi.python.org/pypi/cryptography/0.2.2#downloads的 wheel文件进​​行安装。有效!

I had this error too. After continuing to get this error even after installing openSSL, I eventually tried installing from wheel files from https://pypi.python.org/pypi/cryptography/0.2.2#downloads. It worked!


回答 19

我从pypi下载了paramiko的完整源代码,并做了

python setup.py安装

它完美地工作

rhel中已经存在所有默认的pythondev / openssl / libffi软件包。

下载rpm时rpm不匹配且麻烦更多

i downloaded paramiko full source code from pypi and did

python setup.py install

it worked flawlessly

all default pythondev / openssl /libffi packages are already present in rhel.

downloading rpms have rpm mismatch and more trouble


回答 20

我有同样的问题:

pip install cryptography

.
.
.
Installing collected packages: cffi, cryptography
     Running setup.py install for cffi ... error

然后我安装libffi-devel并解决了问题

yum install libffi-devel

I am having same problem:

pip install cryptography

.
.
.
Installing collected packages: cffi, cryptography
     Running setup.py install for cffi ... error

Then I install libffi-devel and problem is solved

yum install libffi-devel

回答 21

这两个命令为我修复了它:

brew install openssl
brew link openssl --force

来源:https : //github.com/phusion/passenger/issues/1630#issuecomment-147527656

Those two commands fixed it for me:

brew install openssl
brew link openssl --force

Source: https://github.com/phusion/passenger/issues/1630#issuecomment-147527656


回答 22

我通过从加密1.9升级到2.4.2解决了这个问题

I resolved this by upgrading from cryptography 1.9 to 2.4.2


PySyft-用于使用看不到的数据回答问题的库

用于对数据进行计算的库
你不是自己的,也看不到


PySyft是一个Python库,用于安全和私有的深度学习

PySyft将私有数据与模型训练解耦,使用Federated LearningDifferential Privacy和加密计算(如Multi-Party Computation (MPC)Homomorphic Encryption (HE))在主要的深度学习框架(如PyTorch和TensorFlow)中。加入到这场运动中来吧Slack


大多数软件库允许您计算您拥有的信息,并查看您控制的机器的内部情况。但是,这意味着在没有首先获得(至少是部分)信息所有权的情况下,您不能对该信息进行计算。这还意味着,如果不先获得对机器的控制,您就不能使用这些机器进行计算。这对人类协作非常有限,并且系统地推动了数据的集中化,因为如果不先将数据全部放在一个(中心)位置,您就无法处理大量数据

Syft生态系统试图改变这一系统,允许您编写软件,在您无法(完全)控制的计算机上计算您不拥有的信息。这不仅包括云中的服务器,还包括个人台式机、笔记本电脑、手机、网站和边缘设备。无论您的数据想要存放在您拥有的任何地方,Syft生态系统都可以帮助您将其保留在那里,同时允许将其私下用于计算

单声道回购🚝

此repo包含多个协同工作的项目,即PySyft和PyGrid。很快就会添加PyGrid,同时这是目录结构

OpenMined/PySyft
├── README.md   <-- You are here 📌
└── packages
    ├── grid    <-- The Grid droids from OpenMined/PyGrid
    └── syft    <-- The Syft droids you are looking for 👋🏽

注意事项更改整个文件夹结构可能会导致一些小问题。如果您发现了一个,请通知我们或打开公关

PySyft

PySyft是Syft生态系统的核心。它有两个主要目的。您可以使用PySyft执行两种类型的计算:

  1. 动态:直接计算您看不到的数据
  2. 静电:创建静电计算图,以后可以在不同的计算上部署/扩展

这个PyGrid library用作大规模管理和部署PySyft的API。它还允许您使用以下Syft工作器库扩展PySyft,以便在Web、移动和边缘设备上进行联合学习:

  • KotlinSyft(Android)
  • SwiftSyft(IOS)
  • syft.js(JavaScript)
  • PySyft(Python,您可以将PySyft本身用作这些“FL Worker库”之一)

但是,Syft生态系统只关注跨这些语言的一致对象序列化/反序列化、核心抽象和算法设计/执行。仅靠这些库不能将您与现实世界中的数据连接起来。Syft生态系统由网格生态系统提供支持,网格生态系统重点关注运行真实系统以计算和处理数据(如数据合规性Web应用程序)的部署、可扩展性和其他其他问题

  • PySyft是定义对象、抽象和算法的库
  • PyGrid是让您可以在真正的机构中部署它们的平台
  • PyGrid Admin是允许数据所有者管理其PyGrid部署的UI

有关PySyft的更详细说明,请参阅white paper on Arxiv

YouTube上的视频也解释了PySyft:

安装前

PySyft在PyPI和CONDA上可用

我们建议您在如下所示的虚拟环境中安装PySyftConda,因为它易于使用。如果您使用的是Windows,我们建议您安装Anaconda and using the Anaconda
Prompt
要从命令行工作,请执行以下操作

$ conda create -n pysyft python=3.9
$ conda activate pysyft
$ conda install jupyter notebook

版本支持

我们支持Linux操作系统MacOS窗口以及以下Python和Torch版本。旧版本可能可以运行,但我们已停止测试和支持它们

PY/手电筒 1.6 1.7 1.8
3.7
3.8
3.9

安装

管道

$ pip install syft

这将根据需要自动安装PyTorch和其他依赖项,以运行示例和教程。有关从源代码构建的更多信息,请参阅贡献指南here

文档

马上就来!在此之前,请查看以下示例

示例

可以找到示例的综合列表here

这些教程涵盖了各种用于数据科学和机器学习的Python库

所有示例都可以通过启动Jupyter笔记本并导航到examples文件夹

$ jupyter notebook

二重唱

Duet是PySyft中的一个点对点工具,它为数据所有者提供了一个研究友好的API来私下公开他们的数据,而数据科学家可以通过零知识访问控制机制访问或操作所有者端的数据。它旨在降低研究和隐私保护机制之间的屏障,这样就可以在目前无法访问或严格控制的数据上取得科学进展。使用Duet的主要好处是允许您开始使用PySyft,而无需管理完整的PyGrid部署。这是使用Syft的最简单途径,无需安装任何东西(Syft除外😉)

您可以找到所有Duet examplesexamples/duet文件夹

贡献

投稿人指南可以在here它涵盖了现在开始向PySyft贡献代码所需了解的所有内容

此外,加入快速增长的超过12,000人的社区SlackSlake社区非常友好,能够快速回答有关PySyft使用和开发的问题!

免责声明

这个软件是测试版。使用风险自负

关于0.2.x的快速说明

PySyft 0.2.x代码库现在位于自己的分支中here,但OpenMines不会对此版本范围提供官方支持。我们已经编制了一份名单FAQs与此版本相关。_

支持

要获得使用此库的支持,请加入#支持#松弛的渠道。Click here to join our Slack community!

组织贡献

我们非常感谢以下组织对PySyft的贡献!

  • |

许可证

Apache License 2.0

Ciphey-⚡在不知道密钥或密码的情况下自动解密加密、解码编码和破解散列⚡

使用自然语言处理和人工智能的全自动解密/解码/破解工具,以及一些常识

🤔这是什么?

输入加密文本,取回解密文本

“哪种类型的加密?”

这就是问题所在。你不知道,你只知道它可能是加密的。西菲会帮你想办法的

西菲可以在3秒或更短的时间内解决大部分问题。

Ciphey的目标是成为自动化大量解密和解码的工具,例如多基编码、经典密码、散列或更高级的密码术

如果您对密码学了解不多,或者您想在自己处理密文之前快速检查密文,Ciphey适合您

技术部分Ciphey使用定制的人工智能模块(自动搜索),并带有密码检测接口用来近似加密的东西。然后是定制的、可定制的自然语言处理语言检查器界面,它可以检测给定文本何时变为明文。

这里没有神经网络或臃肿的人工智能。我们只用最快最少的东西

而这只是冰山一角。有关完整的技术说明,请查看我们的documentation

✨功能

  • 支持50+加密/编码例如二进制、莫尔斯电码和Base64。经典密码,如凯撒密码、仿射密码和维吉内尔密码。以及现代加密,如重复密钥异或等。For the full list, click here
  • 带有增强搜索的定制人工智能(AuSearch),用于回答“使用了什么加密?”从而导致解密所需的时间不到3秒
  • 定制的自然语言处理模块Ciphey可以确定某些内容是否是明文。无论明文是JSON、CTF标志还是英语,Ciphey都可以在几毫秒内得到它
  • 多语言支持目前,只有德语和英语(带有AU、UK、CAN、USA变体)
  • 支持加密和哈希而像CyberChef Magic这样的替代品是做不到的
  • C++ core惊人的速度

🔭Ciphey vs CyberChef

🔁base64编码42次

名字 ⚡西菲⚡ 🐢网络厨师🐢
GIF
时间 2秒 6秒
设置
  • 对文件运行密码
  • 将正则表达式参数设置为“{”
  • 您需要知道要递归多少次
  • 你要知道一直到现在都是Base64
  • 您需要加载CyberChef(它是一个臃肿的JS应用程序)
  • 对CyberChef有足够的了解来创建这个渠道
  • 把火柴倒过来

注意事项gif可能会在不同的时间加载,因此一个gif的加载速度可能明显快于另一个gif。
关于魔术的注解CyberChef与Ciphey最相似的功能是Magic。Magic在此输入上立即失效并崩溃。我们迫使CyberChef竞争的唯一方法是手动定义它

我们还测试了CyberChef和Ciphey6 GB文件西菲破解了它5分54秒CyberChef还没开始就崩溃了

📊Ciphey vs Katana vs CyberChef Magic

名字 ⚡西菲⚡ 🗡️片名🗡️ 🐢网络厨师魔术🐢
高级语言检查器
支持加密
以反乌托邦主题命名的发行🌃
支持哈希
易于设置
我能猜出什么东西是用什么加密的
由黑客为黑客创建

🎬快速入门

如果您在安装Ciphey时遇到问题,read this.

‼️重要链接(文档、安装指南、不一致支持)

安装指南 文档 不和谐 Docker图像(来自REMnux)
📖Installation Guide 📚Documentation 🦜Discord 🐋Docker Documentation

🏃‍♀️运行Ciphey

有3种方法可以运行Ciphey

  1. 文件输入ciphey -f encrypted.txt
  2. 不合格的输入ciphey -- "Encrypted input"
  3. 正常方式ciphey -t "Encrypted input"

要消除进度条、概率表和所有噪音,请使用静音模式

ciphey -t "encrypted text here" -q

有关参数的完整列表,请运行ciphey --help

⚗️正在导入Ciphey

您可以导入Ciphey的Main并在您自己的程序和代码中使用它。from Ciphey.__main__ import main

🎪贡献者

Ciphey是由Bee2008年,并于2019年复兴。如果没有西菲,它就不会有今天的地位Cyclic3-UOL网络安全协会主席

西菲被复活并重新创造了Cyber Security Society用于CTF。如果你来利物浦,可以考虑做个演讲或赞助我们的活动。给我们发电子邮件到cybersecurity@society.liverpoolguild.org了解更多信息🤠

主要学分感谢George H研究出如何使用适当的算法来加快搜索过程特别感谢varghalladesign用来设计徽标。看看他们的其他设计作品吧!

🐕‍🦺Contributing

不要害怕贡献自己的力量!我们有很多很多你可以做的事情来帮助我们。每一个都贴上标签,并用例子很容易解释。如果你想做贡献却被困住了,那么标签@bee-san✨

或者,加入不和谐组并在那里发送消息(链接到contrib file)或作为徽章出现在本自述文件的顶部

请阅读contributing file有关如何投稿的确切详细信息,请参阅✨

通过这样做,您的名字将被添加到下面的自述文件中,并成为一个不断发展的项目的一部分!

💰财政捐赠者

这笔捐款不仅将用于资助Ciphey及其作者的未来,还将用于资助利物浦大学的网络安全协会

GitHub不支持“赞助这个项目,我们会平均分配资金”,所以选择一个链接,我们会自己解决🥰

✨贡献者

感谢这些优秀的人们(emoji key):


cyclic3

🎨🚧💻🤔

Brandon

🎨🚧💻🤔

michalani

💻

ashb07

💻

Shardion

🐛

Bryan

🌍📖

Lukas Gabriel

💻🐛🌍🤔

Darshan

🐛

SkeletalDemise

💻

Christian Clauss

💻🐛

Machinexa2

🖋

Anant Verma

💻🐛

XVXTOR

📖

Itamikame

💻

MikeMerz

💻

Jacob Galam

💻🐛

TuxTheXplorer

🌍

Itamai

💻🐛

Filipe

🌍

Malathi

💻

Jack

🌍

Younes

🌍

Marnick Vandecauter

🌍

Michael V

💻

chuinzer

🌍

blackcat-917

🌍📖

Åsmund Brekke

💻

Sashreek Shankar

💻

cryptobadger

💻🐛

elf

💻

Roger Yu

💻

dysleixa

💻

Mohammad Zulfikar

📖

此项目遵循all-contributors规格。欢迎任何形式的投稿!