Error installing a crate via cargo: specified package has no binaries

问题解决
头像
523066680
Administrator
Administrator
帖子: 404
注册时间: 2016年07月19日 12:14
拥有现金: 锁定
储蓄: 锁定
Has thanked: 38 times
Been thanked: 52 times
联系:

Error installing a crate via cargo: specified package has no binaries

帖子 #1 523066680 » 2018年12月01日 16:56

error: specified package has no binaries


cargo install is used to install binary packages that happen to be distributed through crates.io.

If you want to use a crate as a dependency, add it to your Cargo.toml.

Read the Rust getting started guide and the Cargo getting started guide for further information. In short:

cargo new my_project
cd my_project
echo 'curl = "0.3.0"' > Cargo.toml

Amusingly, you can install a third-party Cargo subcommand called cargo-edit using cargo install that makes it easier to modify your Cargo.toml file to add dependencies!

cargo install cargo-edit
cargo add curl

An important thing to note is that every Cargo project manages and compiles a separate set of dependencies (some background info). Thus is doesn't make sense to install a compiled library. The source code for each version of a library will be cached locally, avoiding downloading it multiple times.

回到 “TroubleShooting”

在线用户

用户浏览此论坛: 没有注册用户 和 1 访客