import lmdb -> CompileError: сбой команды 'gcc' с состоянием выхода 1 - PullRequest
0 голосов
/ 13 ноября 2018

Я установил библиотеку 'lmdb' с установкой pip, и все прошло гладко.

Позже я попытался импортировать это в блокнот jupyter, но в итоге получил сообщение об ошибке gcc.

Это мой первый раз с lmdb и gcc. Есть ли что-то, что я пропустил, пожалуйста, дайте мне знать. Любая помощь здесь очень ценится.

Система: MacBook Pro

MacOS: Мохаве - 10.14.1

Runnig на Анаконде 1.9.2

Python: 3,6

import os
os.environ['LMDB_FORCE_CFFI'] = '1'

import lmdb

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/lmdb/__init__.py in <module>
     40     if _reading_docs() or os.getenv('LMDB_FORCE_CFFI') is not None:
---> 41         raise ImportError
     42     from lmdb.cpython import *

ImportError: 

During handling of the above exception, another exception occurred:

DistutilsExecError                        Traceback (most recent call last)
/anaconda3/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
    117             self.spawn(compiler_so + cc_args + [src, '-o', obj] +
--> 118                        extra_postargs)
    119         except DistutilsExecError as msg:

/anaconda3/lib/python3.6/distutils/ccompiler.py in spawn(self, cmd)
    908     def spawn(self, cmd):
--> 909         spawn(cmd, dry_run=self.dry_run)
    910 

/anaconda3/lib/python3.6/distutils/spawn.py in spawn(cmd, search_path, verbose, dry_run)
     35     if os.name == 'posix':
---> 36         _spawn_posix(cmd, search_path, dry_run=dry_run)
     37     elif os.name == 'nt':

/anaconda3/lib/python3.6/distutils/spawn.py in _spawn_posix(cmd, search_path, verbose, dry_run)
    158                           "command %r failed with exit status %d"
--> 159                           % (cmd, exit_status))
    160             elif os.WIFSTOPPED(status):

DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

CompileError                              Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/cffi/ffiplatform.py in _build(tmpdir, ext, compiler_verbose, debug)
     50             distutils.log.set_verbosity(compiler_verbose)
---> 51             dist.run_command('build_ext')
     52             cmd_obj = dist.get_command_obj('build_ext')

/anaconda3/lib/python3.6/distutils/dist.py in run_command(self, command)
    973         cmd_obj.ensure_finalized()
--> 974         cmd_obj.run()
    975         self.have_run[command] = 1

/anaconda3/lib/python3.6/distutils/command/build_ext.py in run(self)
    338         # Now actually compile and link everything.
--> 339         self.build_extensions()
    340 

/anaconda3/lib/python3.6/distutils/command/build_ext.py in build_extensions(self)
    447         else:
--> 448             self._build_extensions_serial()
    449 

/anaconda3/lib/python3.6/distutils/command/build_ext.py in _build_extensions_serial(self)
    472             with self._filter_build_errors(ext):
--> 473                 self.build_extension(ext)
    474 

/anaconda3/lib/python3.6/distutils/command/build_ext.py in build_extension(self, ext)
    532                                          extra_postargs=extra_args,
--> 533                                          depends=ext.depends)
    534 

/anaconda3/lib/python3.6/distutils/ccompiler.py in compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends)
    573                 continue
--> 574             self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    575 

/anaconda3/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
    119         except DistutilsExecError as msg:
--> 120             raise CompileError(msg)
    121 

CompileError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

VerificationError                         Traceback (most recent call last)
<ipython-input-26-d7255862df45> in <module>
----> 1 import lmdb

/anaconda3/lib/python3.6/site-packages/lmdb/__init__.py in <module>
     46     if (not _reading_docs()) and os.getenv('LMDB_FORCE_CPYTHON') is not None:
     47         raise
---> 48     from lmdb.cffi import *
     49     from lmdb.cffi import open
     50     from lmdb.cffi import __all__

/anaconda3/lib/python3.6/site-packages/lmdb/cffi.py in <module>
    362         include_dirs=_config_vars['extra_include_dirs'],
    363         libraries=_config_vars['libraries'],
--> 364         library_dirs=_config_vars['extra_library_dirs'])
    365 
    366     @_ffi.callback("int(char *, void *)")

/anaconda3/lib/python3.6/site-packages/cffi/api.py in verify(self, source, tmpdir, **kwargs)
    449         # Make a Verifier() and use it to load the library.
    450         self.verifier = Verifier(self, source, tmpdir, **kwargs)
--> 451         lib = self.verifier.load_library()
    452         #
    453         # Save the loaded library for keep-alive purposes, even

/anaconda3/lib/python3.6/site-packages/cffi/verifier.py in load_library(self)
    102                     if not self._has_source:
    103                         self._write_source()
--> 104                     self._compile_module()
    105             return self._load_library()
    106 

/anaconda3/lib/python3.6/site-packages/cffi/verifier.py in _compile_module(self)
    199         # compile this C source
    200         tmpdir = os.path.dirname(self.sourcefilename)
--> 201         outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
    202         try:
    203             same = ffiplatform.samefile(outputfilename, self.modulefilename)

/anaconda3/lib/python3.6/site-packages/cffi/ffiplatform.py in compile(tmpdir, ext, compiler_verbose, debug)
     20     saved_environ = os.environ.copy()
     21     try:
---> 22         outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
     23         outputfilename = os.path.abspath(outputfilename)
     24     finally:

/anaconda3/lib/python3.6/site-packages/cffi/ffiplatform.py in _build(tmpdir, ext, compiler_verbose, debug)
     56     except (distutils.errors.CompileError,
     57             distutils.errors.LinkError) as e:
---> 58         raise VerificationError('%s: %s' % (e.__class__.__name__, e))
     59     #
     60     return soname

VerificationError: CompileError: command 'gcc' failed with exit status 1
...