我正在使用 Python 虚拟环境来处理项目。设置我的 venv 并从 git 中提取后,我尝试pip install -r requirements.txt
但收到以下错误:
Collecting orjson==3.5.2\n Using cached orjson-3.5.2.tar.gz (740 kB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing metadata (pyproject.toml) ... error\n error: subprocess-exited-with-error\n\n \xc3\x97 Preparing metadata (pyproject.toml) did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [6 lines of output]\n\n Cargo, the Rust package manager, is not installed or is not on PATH.\n This package requires Rust and Cargo to compile extensions. Install it through\n the system\'s package manager or via https://rustup.rs/\n\n Checking for Rust toolchain....\n [end of output]\n\n note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\n
Run Code Online (Sandbox Code Playgroud)\n我使用的是Python版本3.10.2,pip版本22.0.4。
\n知道如何解决这个问题吗?我安装了 Rust,但没有修复它。
\n将虚拟环境移动到本地后,我没有收到以下错误。
\nCollecting orjson==3.5.2\n Using cached orjson-3.5.2.tar.gz (740 kB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing metadata (pyproject.toml) ... error\n error: subprocess-exited-with-error\n\n \xc3\x97 Preparing metadata (pyproject.toml) did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [11 lines of output]\n \xc3\xb0\xc5\xb8\xe2\x80\x99\xc2\xa5 maturin failed\n Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?\n Caused by: `cargo metadata` exited with an error: error: failed to run `rustc` to learn about target-specific information\n\n Caused by:\n process didn\'t exit successfully: `rustc - --crate-name ___ --print=file-names -Z mutable-noalias=yes --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)\n --- stderr\n error: the option `Z` is only accepted on the nightly compiler\n Error running maturin: Command \'[\'maturin\', \'pep517\', \'write-dist-info\', \'--metadata-directory\', \'C:\\\\Users\\\\jawan\\\\AppData\\\\Local\\\\Temp\\\\pip-modern-metadata-hjcwzhua\', \'--interpreter\', \'C:\\\\Users\\\\jawan\\\\Desktop\\\\Programming\\\\imotor\\\\Scripts\\\\python.exe\', \'--manylinux=off\', \'--strip=on\']\' returned non-zero exit status 1.\n Checking for Rust toolchain....\n Running `maturin pep517 write-dist-info --metadata-directory C:\\Users\\jawan\\AppData\\Local\\Temp\\pip-modern-metadata-hjcwzhua --interpreter C:\\Users\\jawan\\Desktop\\Programming\\imotor\\Scripts\\python.exe --manylinux=off --strip=on`\n [end of output]\n\n note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n\xc3\x97 Encountered error while generating package metadata.\n\xe2\x95\xb0\xe2\x94\x80> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\n
Run Code Online (Sandbox Code Playgroud)\n
尝试安装 Rust 编程语言的工具,因为您似乎有一个使用 Rust 的依赖项。
对于 mac 操作系统,我建议使用brew。
brew install rust
Run Code Online (Sandbox Code Playgroud)
否则,请使用Rust 安装页面中的步骤。
您可以使用以下命令检查 Rust 是否安装正确:
rustc --version
Run Code Online (Sandbox Code Playgroud)
完成后再次尝试 pip 安装您的需求文件。
归档时间: |
|
查看次数: |
45704 次 |
最近记录: |