Wenn ich versuche, das Cryptography -Paket für Python entweder durch pip install cryptography
oder durch Herunterladen des Pakets von deren Site zu installieren und python setup.py
auszuführen, erhalte ich die folgende Fehlermeldung:
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
Ich habe andere Fehlerberichte zu Egg_info gefunden ( hier und hier ), aber die dort bereitgestellten Lösungen würden mein Problem nicht lösen. Ich kann auch andere Pakete über PIP installieren.
PIP Version 1.5.4 Setuptools Version 2.2
Ich hatte ein ähnliches Problem und stellte fest, dass mir einfach eine Abhängigkeit (libssl-dev, für mich) fehlte. Stellen Sie, wie in https://cryptography.io/de/latest/installation/ - angegeben, sicher, dass alle Abhängigkeiten erfüllt sind:
Wenn Sie Windows verwenden, müssen Sie sicherstellen, dass OpenSSL installiert ist. Es sind vorkompilierte Binärdateien verfügbar. Wenn sich Ihre Installation an einem ungewöhnlichen Speicherort befindet, setzen Sie die Umgebungsvariablen LIB und INCLUDE so, dass sie die entsprechenden Speicherorte enthalten. Zum Beispiel:
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
kryptografie sollte unter Linux sehr einfach erstellt werden können, vorausgesetzt, Sie verfügen über einen C-Compiler, Header für Python (falls Sie verwenden nicht pypy) und Header für die auf Ihrem System verfügbaren OpenSSL- und Libffi-Bibliotheken.
Für Debian und Ubuntu stellt der folgende Befehl sicher, dass die erforderlichen Abhängigkeiten installiert sind:
Sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Für Fedora und RHEL-Derivate stellt der folgende Befehl sicher, dass die erforderlichen Abhängigkeiten installiert sind:
Sudo yum install gcc libffi-devel python-devel openssl-devel
Sie sollten nun in der Lage sein, Kryptografie mit dem üblichen Standard zu erstellen und zu installieren.
pip install cryptography
Dies ist eine komprimierte Version der Informationen auf der Seite installation docs von cryptography. Informationen hierzu finden Sie auf dieser Seite.
Da diese SO Frage immer wieder auftaucht, werde ich auch hier eine Antwort abgeben (ich bin einer der Entwickler von Pyca/Kryptographie). Was Sie benötigen, um pyca/cryptography zuverlässig auf den 3 wichtigsten Plattformen zu installieren.
Bitte beachten Sie, dass in all diesen Fällen dringend empfohlen wird, dass Sie die Installation in einer virtuellen Umgebung und nicht im globalen Paketbereich vornehmen. Dies ist nicht spezifisch für die Kryptographie, sondern eher allgemeine Ratschläge, um Ihre Python-Installation zuverlässig zu halten. Der globale Paketbereich im Betriebssystem, der für Pythons bereitgestellt wird, gehört dem System, und die Installation von Dingen per Pip erfordert Probleme.
Windows
Upgrade auf das neueste Pip (8.1.2 vom Juni 2016) und nur pip install cryptography
kryptographie und Cffi werden beide als statisch verbundene Räder geliefert.
OS X
Upgrade auf das neueste Pip (8.1.2 vom Juni 2016) und nur pip install cryptography
kryptographie und Cffi werden beide als statisch verbundene Räder geliefert. Dies funktioniert für pyenv Python, System-Python, Homebrew-Python usw. Solange Sie sich auf dem neuesten Pip befinden, benötigen Sie nicht einmal einen Compiler.
Linux
Ab Version 2.0 werden Kryptographie-Räder mit manylinux1 ausgeliefert. Dies bedeutet, dass Benutzer mit pip 8.1+, die auf einer glibc-basierten Distribution (fast alles außer Alpine Linux) und auf x86/x86-64 (sorry Raspberry Pi-Personen) laufen, keinen Compiler oder Header mehr benötigen, da Sie automatisch ein vorkompiliertes Rad erhalten . Also, das erste, was Sie versuchen sollten, ist ein Upgrade Ihres Pip!
Wenn Sie nicht mit Manylinux1 kompatibel sind, müssen Sie Folgendes tun:
Sie benötigen einen C-Compiler, libffi + seine Entwicklungsheader und openssl + seine Entwicklungsheader.
Von Debian oder Ubuntu abgeleitete Distributionen
apt-get install build-essential libssl-dev libffi-dev python-dev
gefolgt von
pip install cryptography
Red Hat abgeleitete Distributionen
yum install gcc openssl-devel libffi-devel python-devel
gefolgt von
pip install cryptography
Für diejenigen von Ihnen, die OS X verwenden, hat sich Folgendes für mich bewährt:
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
(Laufen 10.9 Mavericks)
Sie können auch versuchen, die Flag- und Pip-Befehle mit dem folgenden Kommentar zu verbinden:
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
Dies hat das Problem für mich gelöst (Ubuntu 16.04):
Sudo apt-get install build-essential libssl-dev libffi-dev python-dev python3-dev
und dann funktionierte es so:
pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1
Das hat für mich in El Capitan funktioniert
brew install pkg-config libffi openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography
Sie können den Thread auch hier überprüfen: https://github.com/pyca/cryptography/issues/2350
Wie wurde das Problem "Fehler beim Bereinigen von Installationsdateien für die Kryptographie" gelöst?
(Ich bin von Google gekommen, um diesen Fehler zu erzielen.)
note: Verwendung einer Virtualenv
meine Datei /etc/apt/sources.list
war für mein Debian 8 nicht richtig konfiguriert.
Ich wollte paramiko installieren Paramiko braucht Kryptographie.
Ich habe diese Fehler erhalten: Zuerst mit 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/
und dann mit 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.
(Nicht genau die gleichen Fehler wie OP, aber ich bin hier, um eventuell)
Nachdem ich fast jeden Befehl aus jedem Beitrag getestet habe, bin ich am Ende
https://wiki.debian.org/SourcesList
und kopiert meine passende config in die Datei /etc/apt/sources.list
dann:
Sudo aptitude update
und dann
Sudo apt-get install build-essential libssl-dev libffi-dev python-dev
und dann
pip install cryptography
hth
Anscheinend kann dies bei aktuellen Versionen von OSX darauf zurückzuführen sein, dass Apple eine eigene Version von OpenSSL liefert, die jedoch nicht mit der Kryptographiebibliothek funktioniert.
Neuere Versionen der Kryptografiebibliothek werden mit ihren eigenen nativen Abhängigkeiten ausgeliefert. Um sie jedoch zu erhalten, müssen Sie pip und möglicherweise auch virtuelle Umgebungen aktualisieren. Für mich war die Lösung also:
pip install --upgrade --force-reinstall pip virtualenv
Das hat für mich funktioniert (ich benutze Ubuntu 14.04):
zuerst libffi-dev installieren libssl-dev libpython2.7-dev:
Sudo apt-get install libffi-dev libssl-dev libpython2.7-dev
dann in virtualenv:
pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1
Quellen:
Nick Woodhams Antwort funktionierte für mich nicht unter OSX 10.11 El Capitan, aber das tat es.
brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8
Ich hatte Probleme mit der Installation von cryptography==1.7.1
auf Ubuntu 16.04 und keine der obigen Antworten hat geholfen. Also habe ich die Anforderung auf ein compatible 1.8.2 aufgerüstet und das Setup war erfolgreich. Beachten Sie, dass Sie weiterhin wesentliche Elemente und andere Abhängigkeiten benötigen, die in der Antwort top (am meisten aufgerufenen Antwort) genannt werden.
Ich habe oben viele Lösungen ausprobiert, aber erst nach der Installation der folgenden lib konnte ich cryptography
installieren:
Sudo apt install libssl1.0
Ich verwende Ubuntu 18.04
Wenn Sie Python3 verwenden, müssen Sie python3-dev
installieren. Dies hat mein Problem Sudo apt-get install python3-dev
behoben.
Ich hatte ein Problem mit Sudo pip install cryptography
, weil es beim Kompilieren keine ffi finden würde. (OSX - Yosemite)
Ich habe es gelöst, indem ich libffi heruntergeladen und die env var eingerichtet habe.
$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography
Dies funktioniert auf El Capitan mit MacPorts:
$ Sudo port install openssl
$ env LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography
Ich habe bemerkt, dass das Originalposter eindeutig eine Windows-Installation verwendet hat. Dies setzt voraus, dass Sie Python 2.7 installiert haben, die am meisten unterstützte (obwohl alte) Version.
Pip-Installation (Paket) erneut ausführen, z.
cd C:\Python27\Scripts
pip install cryptography (or pycrypto, fabric, etc)
Ich hatte tatsächlich das gleiche Problem, als ich versuchte, Scrapy zu installieren, was davon abhängt, ob Kryptografie zuerst installiert wird. Ich bin auf Win764-Bit mit Python 2.7 64-Bit installiert. @ jsonms Antwort funktionierte letztendlich für mich, aber zuerst musste ich C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_AMD64.bat
in das x86_AMD64
-Unterverzeichnis innerhalb dieses bin-Verzeichnisses kopieren, damit der vcvarsall.bat
keine Fehlermeldung mehr aussagte, dass die Konfiguration fehlte. Wenn Sie env vars für ein anderes Setup konfigurieren müssen, müssen Sie unbedingt die entsprechende vcvars bat-Datei in das entsprechende Unterverzeichnis kopieren. Andernfalls funktioniert der erste Befehl nicht.
Dann habe ich folgende Befehle von einer Kommandozeile aus nach @ jsonm's Anweisungen ausgeführt (für meine Konfiguration angepasst) ...
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
Und es hat funktioniert.
Ich bin kürzlich auf ein ähnliches Problem gestoßen. In meinem Fall waren die in Requirements.txt geschriebenen Versionen von cffi
und cryptography
nicht kompatibel (cffi == 1.8.9 und Kryptographie == 1.9). Ich habe das Update von cffi
mit der letzten verfügbaren Version behoben.
ich habe Paramiko vollständigen Quellcode von Pypi heruntergeladen und getan
python setup.py installieren
es hat einwandfrei funktioniert
alle Standardpakete pythondev/openssl/libffi sind bereits in rhel vorhanden.
das Herunterladen von RPMs hat Unstimmigkeiten bei der Drehzahl und mehr Probleme
Ich hatte auch diesen Fehler. Nachdem ich diesen Fehler auch nach der Installation von openSSL erhalten hatte, versuchte ich schließlich, die Dateien von https://pypi.python.org/pypi/cryptography/0.2.2#downloads zu installieren. Es funktionierte!
Diese beiden Befehle haben es für mich behoben:
brew install openssl
brew link openssl --force
Quelle: https://github.com/phusion/passenger/issues/1630#issuecomment-147527656
Dies wurde durch ein Upgrade von Kryptografie 1.9 auf 2.4.2 behoben
Ich habe das gleiche Problem:
pip install cryptography
.
.
.
Installing collected packages: cffi, cryptography
Running setup.py install for cffi ... error
Dann installiere ich libffi-devel und das Problem ist gelöst
yum install libffi-devel