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:
当我尝试通过pip安装加密或从他们的站点下载包并运行Python设置时,为Python安装加密包。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
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.
我发现了其他的egg_info错误帖子(这里和这里),但是那里提供的解决方案并不能解决我的问题。另外,我还可以通过PIP安装其他包。
PIP version 1.5.4 setuptools version 2.2
PIP版本1.5.4 setuptools版本2.2。
20 个解决方案
#1
379
I had a similar issue, and found i was simply missing a dependancy (libssl-dev, for me). As referenced in https://cryptography.io/en/latest/installation/, ensure that all dependancies are met:
我有一个类似的问题,发现我只是缺少了一个依赖者(libssldev -dev,对我来说)。中引用https://cryptography。io/en/最新/安装/,确保所有的从属关系都得到满足:
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:
如果你在Windows上,你需要确保你安装了OpenSSL。有预编译的二进制文件可用。如果您的安装在一个不寻常的位置,则设置LIB并包含环境变量以包含相应的位置。例如:
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.
如果您有一个C编译器、Python的头(如果您不使用pypy)、以及系统上可用的OpenSSL和libffi库的头,那么在Linux上加密应该非常容易。
For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:
对于Debian和Ubuntu,以下命令将确保安装所需的依赖项:
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:
对于Fedora和rhelr -衍生物,以下命令将确保安装所需的依赖项:
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
#2
83
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.
既然这个问题不断出现,我也会在这里抛出一个响应(我是pyca/加密开发人员之一)。以下是您需要在3个主要平台上可靠地安装pyca/cryptography的内容。
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.
请注意,在所有这些情况下,强烈建议您安装到virtualenv中,而不是安装到全局包空间中。这不是特定于密码学,而是通用的建议,以使您的Python安装可靠。在OS中提供python的全局包空间由系统拥有,并通过pip将其安装到它是自找麻烦。
Windows
窗户
Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography
升级到最新的pip(2016年6月8.1.2)和pip安装加密。
cryptography and cffi are both shipped as statically linked wheels.
密码学和cffi都是作为静态连接的车轮。
OS X
OS X
Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography
升级到最新的pip(2016年6月8.1.2)和pip安装加密。
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.
密码学和cffi都是作为静态连接的车轮。这将适用于pyenv Python、系统Python、homebrew Python等,只要您在最新的pip上,您甚至不需要编译器。
Linux
Linux
As of version 2.0 cryptography ships manylinux1 wheels. This means users with pip 8.1+ running on a glibc-based distribution (almost everything except Alpine Linux) and on x86/x86-64 (sorry Raspberry Pi people) no longer need a compiler or headers because you'll get a precompiled wheel automatically. So, first thing you should try is upgrading your pip!
在2.0版本的密码学中,有很多linux1*。这意味着pip 8.1+运行在基于glibc的发行版(除了Alpine Linux之外几乎所有的东西)和x86/x86-64(抱歉树莓派的人)不再需要编译器或标头,因为你会自动得到一个预编译的轮。所以,首先你应该尝试升级你的pip!
If you aren't manylinux1 compatible then here's what you need to do:
如果你不是很多linux1兼容,那么以下是你需要做的:
You'll need a C compiler, libffi + its development headers, and openssl + its development headers.
您需要一个C编译器,libffi +它的开发头,以及openssl +它的开发头。
Debian or Ubuntu derived distributions
Debian或Ubuntu派生发行版。
apt-get install build-essential libssl-dev libffi-dev python-dev
followed by
apt-get安装构建必需的libssldev -dev -dev -dev。
pip install cryptography
pip安装加密
Red Hat derived distributions
Red Hat派生的分布
yum install gcc openssl-devel libffi-devel python-devel
followed by
随后,yum安装了gcc opensslr -devel -devel -devel -devel -devel。
pip install cryptography
pip安装加密
#3
40
For those of you running OS X, here is what worked for me:
对于那些运行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
(Running 10.9 Mavericks)
(运行10.9小牛)
You may also want to try merging the flags and pip commands to the following per the comment below:
您还可以尝试将标志和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
#4
22
This worked for me in El Capitan
这在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
您还可以检查这里的线程:https://github.com/pyca/cryptography/producs/2350。
#5
15
This solved the problem for me (Ubuntu 16.04):
这就解决了我的问题(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
#6
14
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.
显然,在最近的OSX版本中,这可能是由于苹果公司发布了他们自己的OpenSSL版本,而这与密码库不兼容。
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,并且可能还需要虚拟环境。所以对我来说,解决方法是:
pip install --upgrade --force-reinstall pip virtualenv
#7
14
How I solved "Failed cleaning build dir for cryptography"
(I came here from google to result for this error.)
我如何解决“失败的加密构建目录”(我从谷歌到这个错误的结果)。
note: using a virtualenv
注意:使用virtualenv
TL;DR:
my file /etc/apt/sources.list
wasn't correctly configured for my debian 8.
我的文件/etc/apt/sources.我的debian 8没有正确配置列表。
Explanations:
I wanted to install paramiko. paramiko needs cryptography.
我想安装paramiko。paramiko需要加密。
I got these errors: first with pip install cryptography
:
我得到了这些错误:首先是pip安装加密:
(...)
----------------------------------------
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
:
然后使用sudo apt-get安装-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)
(和OP的错误不完全一样,但我是来帮忙的)
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
在测试了每个帖子的几乎所有命令后,我最终会使用https://wiki.debian.org/SourcesList,并在文件/etc/apt/sources.list中粘贴适当的配置。
then:
然后:
sudo aptitude update
sudo才能更新
and then
然后
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
sudo apt-get安装构建-必需的libssldev -dev -dev -dev。
and then
然后
pip install cryptography
pip安装加密
hth
hth
#8
8
This worked for me (I'm using Ubuntu 14.04):
这对我有用(我使用Ubuntu 14.04):
first install libffi-dev libssl-dev libpython2.7-dev:
首先安装libf -dev libssl-dev libpython2.7-dev:
sudo apt-get install libffi-dev libssl-dev libpython2.7-dev
then inside virtualenv:
然后在virtualenv:
pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1
Sources:
来源:
https://*.com/a/32800685/5123544
https://*.com/a/32800685/5123544
https://*.com/a/29202163/5123544
https://*.com/a/29202163/5123544
#9
7
Nick Woodham's answer didn't work on OSX 10.11 El Capitan for me, but this did.
尼克·伍德汉姆的回答在osx10.11 El Capitan上并没有奏效,但这确实奏效了。
brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8
#10
3
I was having a problem running sudo pip install cryptography
because it would not find ffi when trying to compile. (OSX - Yosemite)
我在运行sudo pip安装加密时遇到了一个问题,因为它在编译时找不到ffi。(OSX -优胜美地)
I solved it by downloading libffi and setting up the env var.
我通过下载libffi和设置env var来解决它。
$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography
#11
3
This works on El Capitan with MacPorts:
这是在El Capitan和MacPorts的工作:
$ sudo port install openssl
$ env LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography
#12
2
If you are using python3, you need to install python3-dev
. This fixed my problem sudo apt-get install python3-dev
.
如果您使用的是python3,则需要安装python3-dev。这解决了我的问题sudo apt-get安装python3-dev。
#13
1
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.
实际上,我遇到了同样的prob,试图安装依赖于首先安装的加密技术。我已经安装了Python 2.7 64位的win764位。@jsonm最终的答案为我工作,但首先我必须复制C:\Program Files (x86)\Microsoft Visual Studio 9.0 \ VC \ bin \ vcvarsx86_amd64。bat内的x86_amd64子目录,在bin dir中,所以vcvarsall。bat会停止抛出一个错误,说它丢失了配置。如果您需要为不同的设置配置env vars,请确保将相应的vcvars bat文件复制到相应的子目录或下面的第一个命令可能无效。
Then I ran the following from a commandline as per @jsonm's instructions (tweaked for my config)...
然后,按照@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
And it worked.
它工作。
#14
1
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!
我也有这个错误。在安装了openSSL之后,在继续得到这个错误之后,我最终尝试从https://pypi.python.org/pypi/cryptography/0.2.2下载的轮文件中安装。它工作!
#15
1
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.
我注意到,原来的海报显然是在使用windows安装…以上的最佳答案都是针对其他OSs的。这里。这假设您已经安装了Python 2.7,这是最广泛支持的(尽管旧的)版本。
- Install the "Visual C++ Compiler for Python"
- 安装“用于Python的visualc++编译器”
- Open an Administrative command prompt window
- 打开一个管理命令提示窗口。
-
Re-run pip install (package) e.g.
重新运行pip安装(包)。
cd C:\Python27\Scripts pip install cryptography (or pycrypto, fabric, etc)
#16
1
i downloaded paramiko full source code from pypi and did
我从pypi下载了paramiko的完整源代码。
python setup.py install
python的设置。py安装
it worked flawlessly
它运行良好
all default pythondev / openssl /libffi packages are already present in rhel.
所有默认的pythondev / openssl /libffi包都已经存在于rhel中。
downloading rpms have rpm mismatch and more trouble
下载rpms有rpm不匹配和更多的麻烦。
#17
1
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.
最近我遇到了一个类似的问题。在我的例子中,cffi和加密的版本都是在需求中编写的。txt不兼容(cffi==1.8.9和加密==1.9)。我用最后的版本解决了cffi的更新。
#18
1
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 accepted answer.
我在Ubuntu 16.04上安装加密==1.7.1的问题,上面的答案都没有帮助。因此,我将需求升级到兼容的1.8.2,并且安装成功。请注意,您仍然需要在已接受的答案中提到的构建essentials和其他依赖项。
#19
0
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
然后安装libffi-devel,解决问题。
yum install libffi-devel
#20
0
Those two commands fixed it for me:
这两个命令为我解决了:
brew install openssl
brew link openssl --force
Source: https://github.com/phusion/passenger/issues/1630#issuecomment-147527656
来源:https://github.com/phusion/passenger/issues/1630 # issuecomment - 147527656
#1
379
I had a similar issue, and found i was simply missing a dependancy (libssl-dev, for me). As referenced in https://cryptography.io/en/latest/installation/, ensure that all dependancies are met:
我有一个类似的问题,发现我只是缺少了一个依赖者(libssldev -dev,对我来说)。中引用https://cryptography。io/en/最新/安装/,确保所有的从属关系都得到满足:
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:
如果你在Windows上,你需要确保你安装了OpenSSL。有预编译的二进制文件可用。如果您的安装在一个不寻常的位置,则设置LIB并包含环境变量以包含相应的位置。例如:
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.
如果您有一个C编译器、Python的头(如果您不使用pypy)、以及系统上可用的OpenSSL和libffi库的头,那么在Linux上加密应该非常容易。
For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:
对于Debian和Ubuntu,以下命令将确保安装所需的依赖项:
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:
对于Fedora和rhelr -衍生物,以下命令将确保安装所需的依赖项:
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
#2
83
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.
既然这个问题不断出现,我也会在这里抛出一个响应(我是pyca/加密开发人员之一)。以下是您需要在3个主要平台上可靠地安装pyca/cryptography的内容。
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.
请注意,在所有这些情况下,强烈建议您安装到virtualenv中,而不是安装到全局包空间中。这不是特定于密码学,而是通用的建议,以使您的Python安装可靠。在OS中提供python的全局包空间由系统拥有,并通过pip将其安装到它是自找麻烦。
Windows
窗户
Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography
升级到最新的pip(2016年6月8.1.2)和pip安装加密。
cryptography and cffi are both shipped as statically linked wheels.
密码学和cffi都是作为静态连接的车轮。
OS X
OS X
Upgrade to the latest pip (8.1.2 as of June 2016) and just pip install cryptography
升级到最新的pip(2016年6月8.1.2)和pip安装加密。
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.
密码学和cffi都是作为静态连接的车轮。这将适用于pyenv Python、系统Python、homebrew Python等,只要您在最新的pip上,您甚至不需要编译器。
Linux
Linux
As of version 2.0 cryptography ships manylinux1 wheels. This means users with pip 8.1+ running on a glibc-based distribution (almost everything except Alpine Linux) and on x86/x86-64 (sorry Raspberry Pi people) no longer need a compiler or headers because you'll get a precompiled wheel automatically. So, first thing you should try is upgrading your pip!
在2.0版本的密码学中,有很多linux1*。这意味着pip 8.1+运行在基于glibc的发行版(除了Alpine Linux之外几乎所有的东西)和x86/x86-64(抱歉树莓派的人)不再需要编译器或标头,因为你会自动得到一个预编译的轮。所以,首先你应该尝试升级你的pip!
If you aren't manylinux1 compatible then here's what you need to do:
如果你不是很多linux1兼容,那么以下是你需要做的:
You'll need a C compiler, libffi + its development headers, and openssl + its development headers.
您需要一个C编译器,libffi +它的开发头,以及openssl +它的开发头。
Debian or Ubuntu derived distributions
Debian或Ubuntu派生发行版。
apt-get install build-essential libssl-dev libffi-dev python-dev
followed by
apt-get安装构建必需的libssldev -dev -dev -dev。
pip install cryptography
pip安装加密
Red Hat derived distributions
Red Hat派生的分布
yum install gcc openssl-devel libffi-devel python-devel
followed by
随后,yum安装了gcc opensslr -devel -devel -devel -devel -devel。
pip install cryptography
pip安装加密
#3
40
For those of you running OS X, here is what worked for me:
对于那些运行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
(Running 10.9 Mavericks)
(运行10.9小牛)
You may also want to try merging the flags and pip commands to the following per the comment below:
您还可以尝试将标志和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
#4
22
This worked for me in El Capitan
这在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
您还可以检查这里的线程:https://github.com/pyca/cryptography/producs/2350。
#5
15
This solved the problem for me (Ubuntu 16.04):
这就解决了我的问题(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
#6
14
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.
显然,在最近的OSX版本中,这可能是由于苹果公司发布了他们自己的OpenSSL版本,而这与密码库不兼容。
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,并且可能还需要虚拟环境。所以对我来说,解决方法是:
pip install --upgrade --force-reinstall pip virtualenv
#7
14
How I solved "Failed cleaning build dir for cryptography"
(I came here from google to result for this error.)
我如何解决“失败的加密构建目录”(我从谷歌到这个错误的结果)。
note: using a virtualenv
注意:使用virtualenv
TL;DR:
my file /etc/apt/sources.list
wasn't correctly configured for my debian 8.
我的文件/etc/apt/sources.我的debian 8没有正确配置列表。
Explanations:
I wanted to install paramiko. paramiko needs cryptography.
我想安装paramiko。paramiko需要加密。
I got these errors: first with pip install cryptography
:
我得到了这些错误:首先是pip安装加密:
(...)
----------------------------------------
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
:
然后使用sudo apt-get安装-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)
(和OP的错误不完全一样,但我是来帮忙的)
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
在测试了每个帖子的几乎所有命令后,我最终会使用https://wiki.debian.org/SourcesList,并在文件/etc/apt/sources.list中粘贴适当的配置。
then:
然后:
sudo aptitude update
sudo才能更新
and then
然后
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
sudo apt-get安装构建-必需的libssldev -dev -dev -dev。
and then
然后
pip install cryptography
pip安装加密
hth
hth
#8
8
This worked for me (I'm using Ubuntu 14.04):
这对我有用(我使用Ubuntu 14.04):
first install libffi-dev libssl-dev libpython2.7-dev:
首先安装libf -dev libssl-dev libpython2.7-dev:
sudo apt-get install libffi-dev libssl-dev libpython2.7-dev
then inside virtualenv:
然后在virtualenv:
pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1
Sources:
来源:
https://*.com/a/32800685/5123544
https://*.com/a/32800685/5123544
https://*.com/a/29202163/5123544
https://*.com/a/29202163/5123544
#9
7
Nick Woodham's answer didn't work on OSX 10.11 El Capitan for me, but this did.
尼克·伍德汉姆的回答在osx10.11 El Capitan上并没有奏效,但这确实奏效了。
brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8
#10
3
I was having a problem running sudo pip install cryptography
because it would not find ffi when trying to compile. (OSX - Yosemite)
我在运行sudo pip安装加密时遇到了一个问题,因为它在编译时找不到ffi。(OSX -优胜美地)
I solved it by downloading libffi and setting up the env var.
我通过下载libffi和设置env var来解决它。
$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography
#11
3
This works on El Capitan with MacPorts:
这是在El Capitan和MacPorts的工作:
$ sudo port install openssl
$ env LDFLAGS="-L/opt/local/lib" CFLAGS="-I/opt/local/include" pip install cryptography
#12
2
If you are using python3, you need to install python3-dev
. This fixed my problem sudo apt-get install python3-dev
.
如果您使用的是python3,则需要安装python3-dev。这解决了我的问题sudo apt-get安装python3-dev。
#13
1
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.
实际上,我遇到了同样的prob,试图安装依赖于首先安装的加密技术。我已经安装了Python 2.7 64位的win764位。@jsonm最终的答案为我工作,但首先我必须复制C:\Program Files (x86)\Microsoft Visual Studio 9.0 \ VC \ bin \ vcvarsx86_amd64。bat内的x86_amd64子目录,在bin dir中,所以vcvarsall。bat会停止抛出一个错误,说它丢失了配置。如果您需要为不同的设置配置env vars,请确保将相应的vcvars bat文件复制到相应的子目录或下面的第一个命令可能无效。
Then I ran the following from a commandline as per @jsonm's instructions (tweaked for my config)...
然后,按照@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
And it worked.
它工作。
#14
1
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!
我也有这个错误。在安装了openSSL之后,在继续得到这个错误之后,我最终尝试从https://pypi.python.org/pypi/cryptography/0.2.2下载的轮文件中安装。它工作!
#15
1
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.
我注意到,原来的海报显然是在使用windows安装…以上的最佳答案都是针对其他OSs的。这里。这假设您已经安装了Python 2.7,这是最广泛支持的(尽管旧的)版本。
- Install the "Visual C++ Compiler for Python"
- 安装“用于Python的visualc++编译器”
- Open an Administrative command prompt window
- 打开一个管理命令提示窗口。
-
Re-run pip install (package) e.g.
重新运行pip安装(包)。
cd C:\Python27\Scripts pip install cryptography (or pycrypto, fabric, etc)
#16
1
i downloaded paramiko full source code from pypi and did
我从pypi下载了paramiko的完整源代码。
python setup.py install
python的设置。py安装
it worked flawlessly
它运行良好
all default pythondev / openssl /libffi packages are already present in rhel.
所有默认的pythondev / openssl /libffi包都已经存在于rhel中。
downloading rpms have rpm mismatch and more trouble
下载rpms有rpm不匹配和更多的麻烦。
#17
1
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.
最近我遇到了一个类似的问题。在我的例子中,cffi和加密的版本都是在需求中编写的。txt不兼容(cffi==1.8.9和加密==1.9)。我用最后的版本解决了cffi的更新。
#18
1
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 accepted answer.
我在Ubuntu 16.04上安装加密==1.7.1的问题,上面的答案都没有帮助。因此,我将需求升级到兼容的1.8.2,并且安装成功。请注意,您仍然需要在已接受的答案中提到的构建essentials和其他依赖项。
#19
0
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
然后安装libffi-devel,解决问题。
yum install libffi-devel
#20
0
Those two commands fixed it for me:
这两个命令为我解决了:
brew install openssl
brew link openssl --force
Source: https://github.com/phusion/passenger/issues/1630#issuecomment-147527656
来源:https://github.com/phusion/passenger/issues/1630 # issuecomment - 147527656