Rust更换Cargo国内源,镜像了寂寞

这篇具有很好参考价值的文章主要介绍了Rust更换Cargo国内源,镜像了寂寞。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

20231031 写在前面的补记

当我写作此文时,可能理解并不深刻。今日重读 Crates.io 文档,发现它理论上还是可以做到“既换皮又换身的”:

A minimal registry can be implemented by having a git repository that contains an index, and a server that contains the compressed .crate files created by cargo package.

A full-featured registry that supports publishing will additionally need to have a web API service that conforms to the API used by Cargo.

换皮不换身

换了国内源,构建时该卡还会卡。因为它所谓的换源,只是更换crates.io“索引”的源,而不是package“内容”的源。换了国内源后,在国内编译时访问 crates.io-index 自然会快很多,可是crates.io-index里面的信息含量本身就不多,主要是package名称/版本/依赖/特性等,Cargo还要去crates.io网站查询指定package的下载地址,而下载地址也是指向crates.io网站的。最终网络访问瓶颈还是境外的crates.io网站。

换国内源

清华

https://mirrors.tuna.tsinghua.edu.cn/help/crates.io-index.git/

清华大学开源软件镜像站,Rust crates.io 索引镜像使用帮助:
编辑 $CARGO_HOME/config 文件,添加以下内容:

[source.crates-io]
replace-with = 'mirror'

[source.mirror]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

Rust Crates 实践指南 - The Guide to Rust Crates

https://mirrors.gitcode.host/zzy/rust-crate-guide/4-cargo/4.1-source-replacement.html

创建 $HOME/.cargo/config 文件(各操作系统及版本均大致相同),然后在 config 文件内写入下述配置内容:

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
# 指定镜像
replace-with = '镜像源名' # 如:tuna、sjtu、ustc,或者 rustcc

# 注:以下源配置一个即可,无需全部

# 中国科学技术大学
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

# 上海交通大学
[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"

# 清华大学
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

# rustcc社区
[source.rustcc]
registry = "https://code.aliyun.com/rustcc/crates.io-index.git"

查询 crates.io-index

https://github.com/rust-lang/crates.io-index/blob/master/to/ki/tokio

// ingore old vertions ...
{"name":"tokio","vers":"1.30.0","deps":[{"name":"async-stream","req":"^0.3","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"backtrace","req":"^0.3.58","features":[],"optional":false,"default_features":true,"target":"cfg(tokio_taskdump)","kind":"normal"},{"name":"bytes","req":"^1.0.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"futures","req":"^0.3.0","features":["async-await"],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"libc","req":"^0.2.145","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"libc","req":"^0.2.145","features":[],"optional":false,"default_features":true,"target":"cfg(unix)","kind":"dev"},{"name":"loom","req":"^0.7","features":["futures","checkpoint"],"optional":false,"default_features":true,"target":"cfg(loom)","kind":"dev"},{"name":"mio","req":"^0.8.6","features":[],"optional":true,"default_features":false,"target":null,"kind":"normal"},{"name":"mio-aio","req":"^0.7.0","features":["tokio"],"optional":false,"default_features":true,"target":"cfg(target_os = \"freebsd\")","kind":"dev"},{"name":"mockall","req":"^0.11.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"nix","req":"^0.26","features":["fs","socket"],"optional":false,"default_features":false,"target":"cfg(unix)","kind":"dev"},{"name":"num_cpus","req":"^1.8.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"parking_lot","req":"^0.12.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"pin-project-lite","req":"^0.2.11","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"rand","req":"^0.8.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(all(target_family = \"wasm\", target_os = \"unknown\")))","kind":"dev"},{"name":"signal-hook-registry","req":"^1.1.1","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":["all"],"optional":true,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tempfile","req":"^3.1.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tokio-macros","req":"~2.1.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"tokio-stream","req":"^0.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tokio-test","req":"^0.4.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tracing","req":"^0.1.25","features":["std"],"optional":true,"default_features":false,"target":"cfg(tokio_unstable)","kind":"normal"},{"name":"wasm-bindgen-test","req":"^0.3.0","features":[],"optional":false,"default_features":true,"target":"cfg(all(target_family = \"wasm\", not(target_os = \"wasi\")))","kind":"dev"},{"name":"windows-sys","req":"^0.48","features":[],"optional":true,"default_features":true,"target":"cfg(windows)","kind":"normal"},{"name":"windows-sys","req":"^0.48","features":["Win32_Foundation","Win32_Security_Authorization"],"optional":false,"default_features":true,"target":"cfg(windows)","kind":"dev"}],"cksum":"2d3ce25f50619af8b0aec2eb23deebe84249e19e2ddd393a6e16e3300a6dadfd","features":{"default":[],"fs":[],"full":["fs","io-util","io-std","macros","net","parking_lot","process","rt","rt-multi-thread","signal","sync","time"],"io-std":[],"io-util":["bytes"],"macros":["tokio-macros"],"net":["libc","mio/os-poll","mio/os-ext","mio/net","socket2","windows-sys/Win32_Foundation","windows-sys/Win32_Security","windows-sys/Win32_Storage_FileSystem","windows-sys/Win32_System_Pipes","windows-sys/Win32_System_SystemServices"],"process":["bytes","libc","mio/os-poll","mio/os-ext","mio/net","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Threading","windows-sys/Win32_System_WindowsProgramming"],"rt":[],"rt-multi-thread":["num_cpus","rt"],"signal":["libc","mio/os-poll","mio/net","mio/os-ext","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Console"],"stats":[],"sync":[],"test-util":["rt","sync","time"],"time":[]},"yanked":false,"rust_version":"1.63"}
{"name":"tokio","vers":"1.31.0","deps":[{"name":"async-stream","req":"^0.3","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"backtrace","req":"^0.3.58","features":[],"optional":false,"default_features":true,"target":"cfg(tokio_taskdump)","kind":"normal"},{"name":"bytes","req":"^1.0.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"futures","req":"^0.3.0","features":["async-await"],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"libc","req":"^0.2.145","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"libc","req":"^0.2.145","features":[],"optional":false,"default_features":true,"target":"cfg(unix)","kind":"dev"},{"name":"loom","req":"^0.7","features":["futures","checkpoint"],"optional":false,"default_features":true,"target":"cfg(loom)","kind":"dev"},{"name":"mio","req":"^0.8.6","features":[],"optional":true,"default_features":false,"target":null,"kind":"normal"},{"name":"mio-aio","req":"^0.7.0","features":["tokio"],"optional":false,"default_features":true,"target":"cfg(target_os = \"freebsd\")","kind":"dev"},{"name":"mockall","req":"^0.11.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"nix","req":"^0.26","features":["fs","socket"],"optional":false,"default_features":false,"target":"cfg(unix)","kind":"dev"},{"name":"num_cpus","req":"^1.8.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"parking_lot","req":"^0.12.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"pin-project-lite","req":"^0.2.11","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"rand","req":"^0.8.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(all(target_family = \"wasm\", target_os = \"unknown\")))","kind":"dev"},{"name":"signal-hook-registry","req":"^1.1.1","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":["all"],"optional":true,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tempfile","req":"^3.1.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tokio-macros","req":"~2.1.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"tokio-stream","req":"^0.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tokio-test","req":"^0.4.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tracing","req":"^0.1.25","features":["std"],"optional":true,"default_features":false,"target":"cfg(tokio_unstable)","kind":"normal"},{"name":"wasm-bindgen-test","req":"^0.3.0","features":[],"optional":false,"default_features":true,"target":"cfg(all(target_family = \"wasm\", not(target_os = \"wasi\")))","kind":"dev"},{"name":"windows-sys","req":"^0.48","features":[],"optional":true,"default_features":true,"target":"cfg(windows)","kind":"normal"},{"name":"windows-sys","req":"^0.48","features":["Win32_Foundation","Win32_Security_Authorization"],"optional":false,"default_features":true,"target":"cfg(windows)","kind":"dev"}],"cksum":"40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920","features":{"default":[],"fs":[],"full":["fs","io-util","io-std","macros","net","parking_lot","process","rt","rt-multi-thread","signal","sync","time"],"io-std":[],"io-util":["bytes"],"macros":["tokio-macros"],"net":["libc","mio/os-poll","mio/os-ext","mio/net","socket2","windows-sys/Win32_Foundation","windows-sys/Win32_Security","windows-sys/Win32_Storage_FileSystem","windows-sys/Win32_System_Pipes","windows-sys/Win32_System_SystemServices"],"process":["bytes","libc","mio/os-poll","mio/os-ext","mio/net","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Threading","windows-sys/Win32_System_WindowsProgramming"],"rt":[],"rt-multi-thread":["num_cpus","rt"],"signal":["libc","mio/os-poll","mio/net","mio/os-ext","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Console"],"stats":[],"sync":[],"test-util":["rt","sync","time"],"time":[]},"yanked":false,"rust_version":"1.63"}
{"name":"tokio","vers":"1.32.0","deps":[{"name":"async-stream","req":"^0.3","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"backtrace","req":"^0.3.58","features":[],"optional":false,"default_features":true,"target":"cfg(tokio_taskdump)","kind":"normal"},{"name":"bytes","req":"^1.0.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"futures","req":"^0.3.0","features":["async-await"],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"libc","req":"^0.2.145","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"libc","req":"^0.2.145","features":[],"optional":false,"default_features":true,"target":"cfg(unix)","kind":"dev"},{"name":"loom","req":"^0.7","features":["futures","checkpoint"],"optional":false,"default_features":true,"target":"cfg(loom)","kind":"dev"},{"name":"mio","req":"^0.8.6","features":[],"optional":true,"default_features":false,"target":null,"kind":"normal"},{"name":"mio-aio","req":"^0.7.0","features":["tokio"],"optional":false,"default_features":true,"target":"cfg(target_os = \"freebsd\")","kind":"dev"},{"name":"mockall","req":"^0.11.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"nix","req":"^0.26","features":["fs","socket"],"optional":false,"default_features":false,"target":"cfg(unix)","kind":"dev"},{"name":"num_cpus","req":"^1.8.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"parking_lot","req":"^0.12.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"pin-project-lite","req":"^0.2.11","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"rand","req":"^0.8.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(all(target_family = \"wasm\", target_os = \"unknown\")))","kind":"dev"},{"name":"signal-hook-registry","req":"^1.1.1","features":[],"optional":true,"default_features":true,"target":"cfg(unix)","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":["all"],"optional":true,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"normal"},{"name":"socket2","req":"^0.5.3","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tempfile","req":"^3.1.0","features":[],"optional":false,"default_features":true,"target":"cfg(not(target_family = \"wasm\"))","kind":"dev"},{"name":"tokio-macros","req":"~2.1.0","features":[],"optional":true,"default_features":true,"target":null,"kind":"normal"},{"name":"tokio-stream","req":"^0.1","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tokio-test","req":"^0.4.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"dev"},{"name":"tracing","req":"^0.1.25","features":["std"],"optional":true,"default_features":false,"target":"cfg(tokio_unstable)","kind":"normal"},{"name":"wasm-bindgen-test","req":"^0.3.0","features":[],"optional":false,"default_features":true,"target":"cfg(all(target_family = \"wasm\", not(target_os = \"wasi\")))","kind":"dev"},{"name":"windows-sys","req":"^0.48","features":[],"optional":true,"default_features":true,"target":"cfg(windows)","kind":"normal"},{"name":"windows-sys","req":"^0.48","features":["Win32_Foundation","Win32_Security_Authorization"],"optional":false,"default_features":true,"target":"cfg(windows)","kind":"dev"}],"cksum":"17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9","features":{"default":[],"fs":[],"full":["fs","io-util","io-std","macros","net","parking_lot","process","rt","rt-multi-thread","signal","sync","time"],"io-std":[],"io-util":["bytes"],"macros":["tokio-macros"],"net":["libc","mio/os-poll","mio/os-ext","mio/net","socket2","windows-sys/Win32_Foundation","windows-sys/Win32_Security","windows-sys/Win32_Storage_FileSystem","windows-sys/Win32_System_Pipes","windows-sys/Win32_System_SystemServices"],"process":["bytes","libc","mio/os-poll","mio/os-ext","mio/net","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Threading","windows-sys/Win32_System_WindowsProgramming"],"rt":[],"rt-multi-thread":["num_cpus","rt"],"signal":["libc","mio/os-poll","mio/net","mio/os-ext","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Console"],"stats":[],"sync":[],"test-util":["rt","sync","time"],"time":[]},"yanked":false,"rust_version":"1.63"}

Cargo从这里可以拿到历史版本号,依赖项(deps),特性(features)等信息。

查询package

https://crates.io/api/v1/crates/tokio/1.32.0

{"version":{"audit_actions":[{"action":"publish","time":"2023-08-16T21:11:49.973478+00:00","user":{"avatar":"https://avatars.githubusercontent.com/u/6180?v=4","id":10,"login":"carllerche","name":"Carl Lerche","url":"https://github.com/carllerche"}}],"checksum":"17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9","crate":"tokio","crate_size":725004,"created_at":"2023-08-16T21:11:49.973478+00:00","dl_path":"/api/v1/crates/tokio/1.32.0/download","downloads":1848459,"features":{"default":[],"fs":[],"full":["fs","io-util","io-std","macros","net","parking_lot","process","rt","rt-multi-thread","signal","sync","time"],"io-std":[],"io-util":["bytes"],"macros":["tokio-macros"],"net":["libc","mio/os-poll","mio/os-ext","mio/net","socket2","windows-sys/Win32_Foundation","windows-sys/Win32_Security","windows-sys/Win32_Storage_FileSystem","windows-sys/Win32_System_Pipes","windows-sys/Win32_System_SystemServices"],"process":["bytes","libc","mio/os-poll","mio/os-ext","mio/net","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Threading","windows-sys/Win32_System_WindowsProgramming"],"rt":[],"rt-multi-thread":["num_cpus","rt"],"signal":["libc","mio/os-poll","mio/net","mio/os-ext","signal-hook-registry","windows-sys/Win32_Foundation","windows-sys/Win32_System_Console"],"stats":[],"sync":[],"test-util":["rt","sync","time"],"time":[]},"id":873708,"license":"MIT","links":{"authors":"/api/v1/crates/tokio/1.32.0/authors","dependencies":"/api/v1/crates/tokio/1.32.0/dependencies","version_downloads":"/api/v1/crates/tokio/1.32.0/downloads"},"num":"1.32.0","published_by":{"avatar":"https://avatars.githubusercontent.com/u/6180?v=4","id":10,"login":"carllerche","name":"Carl Lerche","url":"https://github.com/carllerche"},"readme_path":"/api/v1/crates/tokio/1.32.0/readme","rust_version":"1.63","updated_at":"2023-08-16T21:11:49.973478+00:00","yanked":false}}

Cargo从这里可以拿到package下载地址:"dl_path":"/api/v1/crates/tokio/1.32.0/download"。这是一个相对地址,前面需要加上crates.io的origin,最终获得完整下载地址:https://crates.io/api/v1/crates/tokio/1.32.0/download

下载package

https://crates.io/api/v1/crates/tokio/1.32.0/download

自动重定向到 https://static.crates.io/crates/tokio/tokio-1.32.0.crate,下载得到的是.crate文件,实际是一个压缩包,解压后就是tokio项目源代码目录树。

前瞻

现有方案不解决主要问题。我想今后Rust还是需要提供crates.io内package下载镜像源的。
20231031 LIIGO补记:参见文首补记,Registry设计本身或许并没有问题。我想今后国内的Rust镜像源会内置下载功能,不用再去境外网站下载。文章来源地址https://www.toymoban.com/news/detail-745768.html

到了这里,关于Rust更换Cargo国内源,镜像了寂寞的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【Rust】Rust学习 第十四章进一步认识 Cargo 和 Crates.io

    本章会讨论 Cargo 其他一些更为高级的功能,我们将展示如何: 使用发布配置来自定义构建 将库发布到 crates.io 使用工作空间来组织更大的项目 从 crates.io 安装二进制文件 使用自定义的命令来扩展 Cargo Cargo 的功能不止本章所介绍的,关于其全部功能的详尽解释,请查看 文

    2024年02月12日
    浏览(39)
  • 【跟小嘉学 Rust 编程】十四、关于 Cargo 和 Crates.io

    【跟小嘉学 Rust 编程】一、Rust 编程基础 【跟小嘉学 Rust 编程】二、Rust 包管理工具使用 【跟小嘉学 Rust 编程】三、Rust 的基本程序概念 【跟小嘉学 Rust 编程】四、理解 Rust 的所有权概念 【跟小嘉学 Rust 编程】五、使用结构体关联结构化数据 【跟小嘉学 Rust 编程】六、枚举

    2024年02月11日
    浏览(49)
  • 【Rust】cargo update或者cargo build国内被墙失败解决办法

    cargo build 时下载失败(Mac 10.13.4),提示: error: failed to download from https://crates-io.proxy.ustclug.org/api/v1/crates/actix-codec/0.3.0/download Caused by: [56] Failure when receiving data from the peer (Received HTTP code 500 from proxy after CONNECT) 或者提示: error: failed to download from https://crates-io.proxy.ustclug.org/api/v1

    2023年04月08日
    浏览(68)
  • 【Rust教程 | 基础系列2 | Cargo工具】Cargo介绍及使用

    在编程世界中,工具的选择与使用同样重要,甚至有时候比编程语言本身更为重要。对于Rust来说,Cargo就是这样一款强大的工具。本文将详细介绍Cargo的各项功能,并通过实例演示如何使用这些功能。希望通过本文,读者能够熟练掌握Cargo的使用,从而更好地进行Rust开发。

    2024年02月15日
    浏览(59)
  • 【Rust 基础篇】Rust Cargo 自定义构建

    在 Rust 中,Cargo 是一个功能强大的构建工具和包管理器,它可以帮助我们管理项目的依赖、构建和发布。Cargo 提供了许多默认的构建行为,但有时我们需要自定义构建过程以满足特定的需求。本篇博客将详细介绍如何在 Rust 中使用 Cargo 自定义构建过程,包括自定义构建脚本、

    2024年02月16日
    浏览(40)
  • Rust 使用Cargo

    假设你正在编写一个 Rust 程序,要使用一个名为 `rand` 的第三方库来生成随机数。首先,你需要在 `Cargo.toml` 文件中添加以下依赖项: ```toml [dependencies] rand = \\\"0.7.3\\\" ``` 然后运行 `cargo build`,Cargo 会自动从 crates.io 上下载和安装 `rand` 库。 在你的 Rust 代码中,你可以像这样使用

    2024年02月07日
    浏览(34)
  • Rust之Cargo的使用

    Cargo 是 Rust 的构建系统和包管理器。⼤多数 Rustacean 们使⽤ Cargo 来管理他们的 Rust 项⽬,因为它可以为你处理很多任务,⽐如构建代码、下载依赖库并编译这些库。(我们把代码所需要的库叫做 依赖(dependencies))。 查看cargo版本 我这里可以看到具体的版本好和日期 第一行

    2024年02月03日
    浏览(32)
  • Rust学习日记(一)Cargo的使用

    前言: 这是一个系列的学习笔记,会将笔者学习Rust语言的心得记录。 当然,这并非是流水账似的记录,而是结合实际程序项目的记录,如果你也对Rust感兴趣,那么我们可以一起交流探讨,使用Rust来构建程序。 注:本文中使用Rust都是在windows环境下,如果是macOS或者linux,其

    2024年02月05日
    浏览(37)
  • ubuntu上安装rust和cargo

    第一种方法: 下面一句话就搞定。但特殊情况下(对rust版本有要求的时候)需要使用第2种方法 第2种方法: 不想用apt 运行后,会让你选择方式,选择1,安装。  How to Install Rust and Cargo on Ubuntu Other Linux

    2024年02月08日
    浏览(60)
  • Cargo, the Rust package manager, is not installed or is not on PATH. 解决方案

    今天在配置一个关键时需要执行pip install logru,在执行过程中出现了以下错误:   error: subprocess-exited-with-error   × Preparing metadata (pyproject.toml) did not run successfully.   │ exit code: 1   ╰─ [6 lines of output]       Cargo, the Rust package manager, is not installed or is not on PATH.       This packag

    2024年02月09日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包