SConscript EnvironmentError: No module named compilation_db

SConscript EnvironmentError: No module named compilation_db

我正在尝试编译 GitHub 项目:https://github.com/commaai/openpilot,我在创建 SCons 环境(调用 Environment())时遇到错误,它指向这一行:

Environement(
# Other options ...
tools=["default", "cython", "compilation_db"
)

scons 的结果是:

scons: Reading SConscript files ...
EnvironmentError: No module named compilation_db:
  File "/home/skoumad/openpilot/master/SConstruct", line 213:
    "compilation_db"
  File "/usr/lib/scons/SCons/Environment.py", line 982:
    apply_tools(self, tools, toolpath)
  File "/usr/lib/scons/SCons/Environment.py", line 107:
    env.Tool(tool)
  File "/usr/lib/scons/SCons/Environment.py", line 1788:
    tool = SCons.Tool.Tool(tool, toolpath, **kw)
  File "/usr/lib/scons/SCons/Tool/__init__.py", line 118:
    module = self._tool_module()
  File "/usr/lib/scons/SCons/Tool/__init__.py", line 215:
    raise SCons.Errors.EnvironmentError(error_string)

我尝试使用 https://pypi.org/project/scons-compiledb/0.4.7/ 安装 compilation_db 但仍然是同样的错误:/.

知道如何安装这个缺失的模块吗??

此致。

您的 SCons 版本可能早于 4.0.0

4.0.0 中添加了 compilation_db 工具

release notice

如果您的发行版(linux、python、macports 等)没有 4.0.0 或更新版本,那么我建议您设置 python virtualenv(不,这不是 VM,它只是一个工具,用于创建一个干净的 python 环境来安装软件包)

操作方法如下:

# assuming posix system, for win32, of course change the path to windows correct syntax
# also the python below should be 3.5 or newer, generally it's best to use the newest installed
python -m venv ~/sconsvenv 
. ~/sconsvenv/bin/activate
pip install  scons

scons --version

# should yield

SCons by Steven Knight et al.:
    SCons: v4.1.0.post1.dc58c175da659d6c0bb3e049ba56fb42e77546cd, 2021-01-20 04:32:28, by bdbaddog on ProDog2020
    SCons path: ['/Users/bdbaddog/sconsvenv/lib/python3.8/site-packages/SCons']
Copyright (c) 2001 - 2021 The SCons Foundation