0

我正在尝试通过 pipenv 安装 gphotos-sync。不幸的是,当 pipenv 尝试安装依赖项时,我遇到了错误

Installing gphotos-sync…
✔ Installation Succeeded
Installing dependencies from Pipfile.lock (f27b09)…
An error occurred while installing psutil==5.7.0 --hash=sha256:1413f4158eb50e110777c4f15d7c759521703bd6beb58926f1d562da40180058 --hash=sha256:298af2f14b635c3c7118fd9183843f4e73e681bb6f01e12284d4d70d48a60953 --hash=sha256:60b86f327c198561f101a92be1995f9ae0399736b6eced8f24af41ec64fb88d4 --hash=sha256:685ec16ca14d079455892f25bd124df26ff9137664af445563c1bd36629b5e0e --hash=sha256:73f35ab66c6c7a9ce82ba44b1e9b1050be2a80cd4dcc3352cc108656b115c74f --hash=sha256:75e22717d4dbc7ca529ec5063000b2b294fc9a367f9c9ede1f65846c7955fd38 --hash=sha256:a02f4ac50d4a23253b68233b07e7cdb567bd025b982d5cf0ee78296990c22d9e --hash=sha256:d008ddc00c6906ec80040d26dc2d3e3962109e40ad07fd8a12d0284ce5e0e4f8 --hash=sha256:d84029b190c8a66a946e28b4d3934d2ca1528ec94764b180f7d6ea57b0e75e26 --hash=sha256:e2d0c5b07c6fe5a87fa27b7855017edb0d52ee73b71e6ee368fae268605cc3f5 --hash=sha256:f344ca230dd8e8d5eee16827596f1c22ec0876127c28e800d7ae20ed44c4b310! Will try again.
     ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 14/14 — 00:00:15
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]:       skip_lock=skip_lock,
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.7/dist-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting psutil==5.7.0', '  Using cached psutil-5.7.0.tar.gz (449 kB)', 'Building wheels for collected packages: psutil', '  Building wheel for psutil (setup.py): started', "  Building wheel for psutil (setup.py): finished with status 'error'", '  Running setup.py clean for psutil', 'Failed to build psutil', 'Installing collected packages: psutil', '    Running setup.py install for psutil: started', "    Running setup.py install for psutil: finished with status 'error'"]
[pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1

错误消息持续多页。我记得安装 pipenv 时出现错误消息,但是通过重新安装时我没有收到任何消息

python3 -m pip install pipenv --force-reinstall

一切似乎都很顺利。由于 pipenv 需要 psutil 并且在上面的错误消息中提到,我也尝试强制重新安装它。这会导致另一个错误消息:

~/gphotos-sync# python3 -m pip install psutil --force-reinstall
Collecting psutil
  Using cached psutil-5.7.0.tar.gz (449 kB)
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vmk57m02/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vmk57m02/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-gttht4x_
       cwd: /tmp/pip-install-vmk57m02/psutil/
  Complete output (112 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psosx.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pssunos.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pslinux.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psaix.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/__init__.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psposix.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_common.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_compat.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_psbsd.py -> build/lib.linux-x86_64-3.7/psutil
  copying psutil/_pswindows.py -> build/lib.linux-x86_64-3.7/psutil
  creating build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/runner.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-3.7/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-3.7/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/psutil
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/include/python3.7m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.7/psutil/_psutil_common.o
  unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
  Traceback (most recent call last):
    File "/usr/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
      extra_postargs)
    File "/usr/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
      spawn(cmd, dry_run=self.dry_run)
    File "/usr/lib/python3.7/distutils/spawn.py", line 36, in spawn
      _spawn_posix(cmd, search_path, dry_run=dry_run)
    File "/usr/lib/python3.7/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.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/dist-packages/wheel/bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/dist-packages/setuptools/command/build_ext.py", line 87, in run
      _build_ext.run(self)
    File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/command/build_ext.py", line 208, in build_extension
      _build_ext.build_extension(self, ext)
    File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
      depends=ext.depends)
    File "/usr/lib/python3.7/distutils/ccompiler.py", line 574, in compile
      self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
    File "/usr/lib/python3.7/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 "/tmp/pip-install-vmk57m02/psutil/setup.py", line 393, in main
      setup(**kwargs)
    File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/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-install-vmk57m02/psutil/setup.py", line 426, in <module>
      main()
    File "/tmp/pip-install-vmk57m02/psutil/setup.py", line 400, in main
      missdeps("sudo apt-get install gcc python%s-dev" % py3)
    File "/tmp/pip-install-vmk57m02/psutil/setup.py", line 116, in missdeps
      s = hilite("C compiler or Python headers are not installed ", ok=False)
  TypeError: hilite() got an unexpected keyword argument 'ok'
  ----------------------------------------
  ERROR: Failed building wheel for psutil
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
  Attempting uninstall: psutil
    Found existing installation: psutil 5.5.1
ERROR: Cannot uninstall 'psutil'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

我还尝试重新安装 setuptools 和 wheel,效果很好。

我正在使用 Python 3.7.3

还有什么我可以尝试的吗?

4

1 回答 1

0

@phd

感谢您的链接!通过 apt-get 安装 build-essential 解决了所有问题。

于 2020-03-05T12:25:37.157 回答