windows - 无法安装货物树:无法确定视觉工作室生成器
问题描述
我正在尝试在我的 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 架构)
推荐阅读
- ruby-on-rails - Ruby:LoadError 库版本不兼容
- salesforce - Cognito with Salesforce - 登录时出错
- regex - Notepad ++中的正则表达式:删除两个给定表达式之间的任意数量的行
- javascript - 将 AWS Lambda 与计划事件一起使用时,递归 Lambda 函数停止
- ansible - 自定义 Ansible 回调未收到 group_vars/host_vars
- excel - 没有用户选择的圆角线
- javascript - Apexcharts 条形图未出现在 Vue.js 项目中
- java - 获取非空白输入的方法
- r - 如何根据时间对象是否位于其他两个时间对象之间来制作分类变量
- android - 如何特别在设备 API 级别 25、26、27 上以编程方式结束来电