我在 Cargo.toml
中有这个
[dependencies.postgres]
git = "https://github.com/sfackler/rust-postgres.git"
运行 cargo build
时会产生以下输出:
$ cargo build -u
Updating git repository `https://github.com/sfackler/rust-postgres.git`
No package named `postgres` found (required by `hello-world`).
Location searched: https://github.com/sfackler/rust-postgres.git
Version required: *
我在这里错过了什么?
最佳答案
更改[dependencies.postgres]
[dependencies.rust-postgres]
原因是:Cargo.toml该包的定义包名称为 rust-postgres
,这需要匹配。
但是请注意,它还将其 lib
的名称定义为 postgres
。
所以你会做 extern crate postgres;
(不是 extern crate rust-postgres;
)
关于postgresql - Rust cargo 找不到 postgres 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25052767/