我的操作系统:Mac OS X El Capitan
当我像这样安装密码学模块:
pip install cryptography==0.2.1
错误是:
Collecting cryptography==0.2.1
Using cached cryptography-0.2.1.tar.gz
Complete output from command python setup.py egg_info:
no previously-included directories found matching 'documentation/_build'
zip_safe flag not set; analyzing archive contents...
six: module references __path__
Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/six-1.10.0-py2.7.egg
Searching for cffi>=0.8
Reading https://pypi.python.org/simple/cffi/
Best match: cffi 1.5.0
Downloading https://pypi.python.org/packages/source/c/cffi/cffi-1.5.0.tar.gz#md5=dec8441e67880494ee881305059af656
Processing cffi-1.5.0.tar.gz
Writing /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-ZAtQYR/cffi-1.5.0/setup.cfg
Running cffi-1.5.0/setup.py -q bdist_egg --dist-dir /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-ZAtQYR/cffi-1.5.0/egg-dist-tmp-Dl08xt
creating /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg
Extracting cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg to /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs
Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg
Searching for pycparser
Reading https://pypi.python.org/simple/pycparser/
Best match: pycparser 2.14
Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz#md5=a2bc8d28c923b4fe2b2c3b4b51a4f935
Processing pycparser-2.14.tar.gz
Writing /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-80l9Lo/pycparser-2.14/setup.cfg
Running pycparser-2.14/setup.py -q bdist_egg --dist-dir /var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/easy_install-80l9Lo/pycparser-2.14/egg-dist-tmp-5dC3Ib
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
zip_safe flag not set; analyzing archive contents...
Copying pycparser-2.14-py2.7.egg to /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs
Installed /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/pycparser-2.14-py2.7.egg
running egg_info
creating pip-egg-info/cryptography.egg-info
writing requirements to pip-egg-info/cryptography.egg-info/requires.txt
writing pip-egg-info/cryptography.egg-info/PKG-INFO
writing top-level names to pip-egg-info/cryptography.egg-info/top_level.txt
writing dependency_links to pip-egg-info/cryptography.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/cryptography.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
cryptography/hazmat/bindings/__pycache__/_cffi__xfdb41ad9xb4fc9075.c:369:5: error: conflicting types for 'ASN1_GENERALIZEDTIME_check'
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *);
^
/usr/local/include/openssl/asn1.h:856:5: note: previous declaration is here
int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
^
1 error generated.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/setup.py", line 113, in <module>
"build": cffi_build,
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 180, in run
self.find_sources()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
mm.run()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 291, in run
self.add_defaults()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
sdist.add_defaults(self)
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/sdist.py", line 118, in add_defaults
build_py = self.get_finalized_command('build_py')
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
cmd_obj.ensure_finalized()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/site-packages/setuptools/command/build_py.py", line 28, in finalize_options
orig.build_py.finalize_options(self)
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/command/build_py.py", line 46, in finalize_options
('force', 'force'))
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 298, in set_undefined_options
src_cmd_obj.ensure_finalized()
File "/Users/username/.pyenv/versions/2.7.11/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
self.finalize_options()
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/setup.py", line 55, in finalize_options
OpenSSLBinding().ffi.verifier.get_extension(),
File "cryptography/hazmat/bindings/openssl/binding.py", line 83, in __init__
self._ensure_ffi_initialized()
File "cryptography/hazmat/bindings/openssl/binding.py", line 99, in _ensure_ffi_initialized
libraries)
File "cryptography/hazmat/bindings/utils.py", line 72, in build_ffi
ext_package="cryptography",
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/api.py", line 433, in verify
lib = self.verifier.load_library()
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/verifier.py", line 110, in load_library
self._compile_module()
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/verifier.py", line 207, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/ffiplatform.py", line 29, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose)
File "/private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography/.eggs/cffi-1.5.0-py2.7-macosx-10.11-x86_64.egg/cffi/ffiplatform.py", line 62, in _build
raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.ffiplatform.VerificationError: CompileError: command 'clang' failed with exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/48/lrr_y58s4rq70qdnjcvqc8l8j2g31b/T/pip-build-zGO9s0/cryptography
我确定已经将openssl
升级到最新版本:
$ openssl version
OpenSSL 1.0.2f 28 Jan 2016
但是我不知道如何修复它。即使我查看了官方文档:
并按照那样做,结果仍然一样。https://cryptography.io/en/latest/installation/#building-cryptography-on-os-x