无法使用pip3安装加密技术(Ubuntu 16.04 LTS)

时间:2016-09-09 15:15:26

标签: python-3.x ubuntu

我目前在使用pip3安装加密时遇到问题。 我尝试了所有其他解决方案,但没有解决方案。

以下是“sudo -H pip install cryptography”的输出:

Collecting cryptography
  Using cached cryptography-1.5.tar.gz
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /usr/local/lib/python3.5/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /usr/lib/python3/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python3.5/dist-packages (from cryptography)
Collecting cffi>=1.4.1 (from cryptography)
  Using cached cffi-1.8.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.4.1->cryptography)
Building wheels for collected packages: cryptography, cffi
  Running setup.py bdist_wheel for cryptography ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2saf6qpj/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpme9hnxc5pip-wheel- --python-tag cp35:
  c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  Traceback (most recent call last):
    File "/usr/lib/python3.5/distutils/unixccompiler.py", line 118, in _compile
      extra_postargs)
    File "/usr/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
      spawn(cmd, dry_run=self.dry_run)
    File "/usr/lib/python3.5/distutils/spawn.py", line 36, in spawn
      _spawn_posix(cmd, search_path, dry_run=dry_run)
    File "/usr/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
      % (cmd, exit_status))
  distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 161, in run
      cmd = self.call_command('install_lib', warn_dir=0)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 147, in call_command
      self.run_command(cmdname)
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install_lib.py", line 11, in run
      self.build()
    File "/usr/lib/python3.5/distutils/command/install_lib.py", line 109, in build
      self.run_command('build_ext')
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/build_ext.py", line 77, in run
      _build_ext.run(self)
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 338, in run
      self.build_extensions()
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 447, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 472, in _build_extensions_serial
      self.build_extension(ext)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/build_ext.py", line 198, in build_extension
      _build_ext.build_extension(self, ext)
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 532, in build_extension
      depends=ext.depends)
    File "/usr/lib/python3.5/distutils/ccompiler.py", line 574, in compile
      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    File "/usr/lib/python3.5/distutils/unixccompiler.py", line 120, in _compile
      raise CompileError(msg)
  distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 156, in save_modules
      yield saved
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 246, in run_setup
      DirectorySandbox(setup_dir).run(runner)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 276, in run
      return func()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 245, in runner
      _execfile(setup_script, ns)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in _execfile
      exec(code, globals, locals)
    File "/tmp/easy_install-sjss3av8/cffi-1.8.2/setup.py", line 193, in <module>
      return True
    File "/usr/lib/python3.5/distutils/core.py", line 163, in setup
      raise SystemExit("error: " + str(msg))
  SystemExit: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1100, in run_setup
      run_setup(setup_script, args)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 249, in run_setup
      raise
    File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
      self.gen.throw(type, value, traceback)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
      self.gen.throw(type, value, traceback)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 168, in save_modules
      saved_exc.resume()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 143, in resume
      six.reraise(type, exc, self._tb)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/_vendor/six.py", line 685, in reraise
      raise value.with_traceback(tb)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 156, in save_modules
      yield saved
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 246, in run_setup
      DirectorySandbox(setup_dir).run(runner)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 276, in run
      return func()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 245, in runner
      _execfile(setup_script, ns)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in _execfile
      exec(code, globals, locals)
    File "/tmp/easy_install-sjss3av8/cffi-1.8.2/setup.py", line 193, in <module>
      return True
    File "/usr/lib/python3.5/distutils/core.py", line 163, in setup
      raise SystemExit("error: " + str(msg))
  SystemExit: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-2saf6qpj/cryptography/setup.py", line 334, in <module>
      **keywords_with_side_effects(sys.argv)
    File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
      _setup_distribution = dist = klass(attrs)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 348, in __init__
      self.fetch_build_eggs(attrs['setup_requires'])
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 394, in fetch_build_eggs
      replace_conflicting=True,
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 851, in resolve
      dist = best[req.key] = env.best_match(req, ws, installer)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1123, in best_match
      return self.obtain(req, installer)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1135, in obtain
      return installer(requirement)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 461, in fetch_build_egg
      return cmd.easy_install(req)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 664, in easy_install
      return self.install_item(spec, dist.location, tmpdir, deps)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 694, in install_item
      dists = self.install_eggs(spec, download, tmpdir)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 875, in install_eggs
      return self.build_and_install(setup_script, setup_base)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1114, in build_and_install
      self.run_setup(setup_script, setup_base, args)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1102, in run_setup
      raise DistutilsError("Setup script exited with %s" % (v.args[0],))
  distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptography
  Running setup.py clean for cryptography
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2saf6qpj/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" clean --all:
  c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  Traceback (most recent call last):
    File "/usr/lib/python3.5/distutils/unixccompiler.py", line 118, in _compile
      extra_postargs)
    File "/usr/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
      spawn(cmd, dry_run=self.dry_run)
    File "/usr/lib/python3.5/distutils/spawn.py", line 36, in spawn
      _spawn_posix(cmd, search_path, dry_run=dry_run)
    File "/usr/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
      % (cmd, exit_status))
  distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 161, in run
      cmd = self.call_command('install_lib', warn_dir=0)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/bdist_egg.py", line 147, in call_command
      self.run_command(cmdname)
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/install_lib.py", line 11, in run
      self.build()
    File "/usr/lib/python3.5/distutils/command/install_lib.py", line 109, in build
      self.run_command('build_ext')
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/build_ext.py", line 77, in run
      _build_ext.run(self)
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 338, in run
      self.build_extensions()
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 447, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 472, in _build_extensions_serial
      self.build_extension(ext)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/build_ext.py", line 198, in build_extension
      _build_ext.build_extension(self, ext)
    File "/usr/lib/python3.5/distutils/command/build_ext.py", line 532, in build_extension
      depends=ext.depends)
    File "/usr/lib/python3.5/distutils/ccompiler.py", line 574, in compile
      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    File "/usr/lib/python3.5/distutils/unixccompiler.py", line 120, in _compile
      raise CompileError(msg)
  distutils.errors.CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 156, in save_modules
      yield saved
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 246, in run_setup
      DirectorySandbox(setup_dir).run(runner)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 276, in run
      return func()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 245, in runner
      _execfile(setup_script, ns)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in _execfile
      exec(code, globals, locals)
    File "/tmp/easy_install-rfvxg0ae/cffi-1.8.2/setup.py", line 193, in <module>
      return True
    File "/usr/lib/python3.5/distutils/core.py", line 163, in setup
      raise SystemExit("error: " + str(msg))
  SystemExit: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1100, in run_setup
      run_setup(setup_script, args)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 249, in run_setup
      raise
    File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
      self.gen.throw(type, value, traceback)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
      self.gen.throw(type, value, traceback)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 168, in save_modules
      saved_exc.resume()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 143, in resume
      six.reraise(type, exc, self._tb)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/_vendor/six.py", line 685, in reraise
      raise value.with_traceback(tb)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 156, in save_modules
      yield saved
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 197, in setup_context
      yield
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 246, in run_setup
      DirectorySandbox(setup_dir).run(runner)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 276, in run
      return func()
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 245, in runner
      _execfile(setup_script, ns)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/sandbox.py", line 47, in _execfile
      exec(code, globals, locals)
    File "/tmp/easy_install-rfvxg0ae/cffi-1.8.2/setup.py", line 193, in <module>
      return True
    File "/usr/lib/python3.5/distutils/core.py", line 163, in setup
      raise SystemExit("error: " + str(msg))
  SystemExit: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-2saf6qpj/cryptography/setup.py", line 334, in <module>
      **keywords_with_side_effects(sys.argv)
    File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
      _setup_distribution = dist = klass(attrs)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 348, in __init__
      self.fetch_build_eggs(attrs['setup_requires'])
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 394, in fetch_build_eggs
      replace_conflicting=True,
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 851, in resolve
      dist = best[req.key] = env.best_match(req, ws, installer)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1123, in best_match
      return self.obtain(req, installer)
    File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1135, in obtain
      return installer(requirement)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 461, in fetch_build_egg
      return cmd.easy_install(req)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 664, in easy_install
      return self.install_item(spec, dist.location, tmpdir, deps)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 694, in install_item
      dists = self.install_eggs(spec, download, tmpdir)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 875, in install_eggs
      return self.build_and_install(setup_script, setup_base)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1114, in build_and_install
      self.run_setup(setup_script, setup_base, args)
    File "/usr/local/lib/python3.5/dist-packages/setuptools/command/easy_install.py", line 1102, in run_setup
      raise DistutilsError("Setup script exited with %s" % (v.args[0],))
  distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed cleaning build dir for cryptography
  Running setup.py bdist_wheel for cffi ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2saf6qpj/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp689jaw0cpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/cparser.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/recompiler.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/commontypes.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/verifier.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/model.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/api.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/__init__.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/lock.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.5/cffi
  copying cffi/_embedding.h -> build/lib.linux-x86_64-3.5/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/c
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.5/c/_cffi_backend.o
  c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cffi
  Running setup.py clean for cffi
Failed to build cryptography cffi
Installing collected packages: cffi, cryptography
  Running setup.py install for cffi ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2saf6qpj/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7jmqgdpf-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/cparser.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/recompiler.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/commontypes.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/verifier.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/model.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/api.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/__init__.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/lock.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.5/cffi
    copying cffi/_embedding.h -> build/lib.linux-x86_64-3.5/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/c
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.5/c/_cffi_backend.o
    c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-2saf6qpj/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7jmqgdpf-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2saf6qpj/cffi/

我尝试了解错误,但所有错误都说“错误代码为1”:/

检查其他问题,他们提到了加密的依赖关系,这些关系已经安装并且是最新的(sudo apt-get install build-essential libssl-dev libffi-dev python-dev):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
libffi-dev is already the newest version (3.2.1-4).
python-dev is already the newest version (2.7.11-1).
libssl-dev is already the newest version (1.0.2g-1ubuntu4.2).
0 upgraded, 0 newly installed, 0 to remove and 135 not upgraded.

pip3版本:

pip 8.1.2 from /usr/local/lib/python3.5/dist-packages (python 3.5)

甚至还没有easy_install工作。我真的不知道我在这里做错了什么,请帮忙。

1 个答案:

答案 0 :(得分:3)

根据日志各个位置出现的Python.h: No such file or directory错误消息,您需要安装python3-dev

sudo apt install python3-dev