我正在尝试在Windows计算机上安装cargo-tree。它使用Windows 10,Visual Studio构建工具15。这是我的主动rustup工具链:

active toolchain
----------------

stable-x86_64-pc-windows-msvc (default)
rustc 1.26.0 (a77568041 2018-05-07)

运行cargo install cargo-tree时,构建失败。构建日志的结尾为:

error: failed to run custom build command for `libssh2-sys v0.2.7`
process didn't exit successfully: `C:\Users\NICOLA~1\AppData\Local\Temp\cargo-installt7F5FM\release\build\libssh2-sys-726b9e90a2ed2b95\build-script-build` (exit code: 101)
--- stderr
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at '

couldn't determine visual studio generator
if VisualStudio is installed, however, consider running the appropriate vcvars script before building this crate
', C:\Users\nicolas-delsaux\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.31\src\lib.rs:552:25
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-tree v0.18.0`, intermediate artifacts can be found at `C:\Users\NICOLA~1\AppData\Local\Temp\cargo-installt7F5FM`

根据我在网上找到的一些文档,它似乎与要调用的vcvars脚本和要安装的旧Visual Studio版本有关。我不完全了解该怎么做
  • 我应该安装旧版本的Visual Studio吗?
  • 我要运行一些脚本吗?
  • 最佳答案

    根据@ user25064,这需要通过开发人员命令提示符安装命令(更具体地说,是针对您的体系结构的开发人员命令提示符-注意x86/x64体系结构)

    关于windows - 无法安装货树: couldn't determine visual studio generator,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50749050/

    10-11 23:09
    查看更多