安装Jupyter Notebook 之不断报错 差点放弃版
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 package requires Rust and Cargo to compile extensions. Install it through the system's package manager or via https://rustup.rs/ Checking for Rust toolchain.... [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
报错内容如上。
我是windows电脑。
上面报错 其实是缺少 Rust。
Windows 用户
-
下载并运行
rustup-init.exe
-
从官网下载:https://rustup.rs 或直接下载 rustup-init.exe。
-
双击运行,在弹出的命令行窗口中:
-
按 回车 选择默认安装。
-
输入
1
并回车,确认安装。 -
其实安装后是安装Microsoft Visual Studio。安装后最好重启电脑。
-
安装 Rust 后仍报错
-
确保关闭所有 CMD/PowerShell 窗口后重新打开,让环境变量生效。
-
运行
rustup update
更新 Rust 工具链。
-
-
网络问题
-
使用国内镜像加速 Rust 安装:
cmd
复制
下载
set RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static set RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
-
-
所以需要再次运行一次
rustup-init.exe
-
这时候cmd运行下面命令 发现有了就OK了。
rustc --version cargo --version
- 再次 pip install notebook 即可
-
-