为什么安装 dbt 失败? - 树保姆的建筑轮子失败

Why installation of dbt fails? - Failed building wheel for tree-sitter

我正在尝试将 dbt 工具安装到 Window 10。安装了 Python 3.9 和 VS2019。(我不知道为什么需要)

我遇到奇怪的错误,想知道错误以及应该做什么:

命令:

git clone https://github.com/fishtown-analytics/dbt.git
cd dbt
pip install -r requirements.txt

错误:

  ERROR: Command errored out with exit status 1:
   command: 'c:\users\my.name\appdata\local\programs\python\python39\python.exe' 
 'c:\users\my.name\appdata\local\programs\python\python39\lib\site- 
packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 
 'C:\Users\MY~1.NAME\AppData\Local\Temp\tmpzybnxyld'
       cwd: C:\Users\my.name\AppData\Local\Temp\pip-install-l8pl5jty\tree- 
 sitter_f257da752ba04b9dacbc947d2d743146
  Complete output (10 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\tree_sitter
  copying tree_sitter\__init__.py -> build\lib.win-amd64-3.9\tree_sitter
  running build_ext
  building 'tree_sitter.binding' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build 
  Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for tree-sitter

dbt 的当前开发版本(develop 分支,或可安装为 v0.20.0rc1)需要两个新的依赖项:

  • tree-sitter==0.19.0
  • tree-sitter-jinja2==0.1.0a1

第一个 tree-sitter 要求您在系统上安装 C 编译器。查看 GitHub 上的相关问题:https://github.com/fishtown-analytics/dbt/issues/3433

我们将考虑如何让安装体验更顺畅。同时,您可以 install GCC 然后再次尝试从源安装 dbt。

我暂时的建议是坚持之前的版本(stable 0.19.0 在此评论时)因为在这种情况下安装依赖项会花费大量时间,而且还因为建议不要将 dbt 安装在默认 python 包中,而是安装在虚拟环境中。

所以,简而言之

pip install dbt==0.19.0