如何安装 ndarray crate?

How to install ndarray crate?

以下是我试过的方法:

  1. 运行“cargo install ndarray”,错误:指定的包ndarray v0.15.1没有二进制文件
  2. 下载、解压并运行“cargo build”、“cargo install --path”。来自“https://github.com/rust-ndarray/ndarray”,错误:指定的包 ndarray v0.15.1 (C:\Users\Administrator\Downloads\ndarray-master) 没有二进制文件
  3. 使用 [dependencies] ndarray = {path = "C:/Users/Administrator/Downloads/ndarray-master"} 编辑“Cargo.toml”,错误:错误[E0463]:找不到 [=13= 的箱子]

顺便说一句,代码在这里:

extern crate ndarray;

fn main() {
    println!("Hello, world!");
}

感谢任何帮助。提前谢谢你。

您不需要在 Rust 中安装 crate。您只需在项目的 Cargo.toml 文件中声明它们:

[dependencies]
ndarray = "0.15.1"

当您构建项目时,cargo 将即时下载并构建所需的 crate。 See more here.