我是Python新手。我正在尝试安装 numpy 但出现此错误。 收集忍者>=1.8.2 使用缓存的 ninja-1.11.1.tar.gz (27 kB) 安装构建依赖项:已开始 安装构建依赖项:已完成,状态为“完成” 获取构建轮子的要求:开始 获取构建轮子的要求:已完成,状态为“完成” 准备元数据(pyproject.toml):开始 准备元数据(pyproject.toml):已完成,状态为“完成” 为收集的包裹建造轮子:忍者 忍者构建轮子(pyproject.toml):已启动 忍者的构建轮子(pyproject.toml):已完成,状态为“错误” 错误:子进程退出并出现错误
Building wheel for ninja (pyproject.toml) did not run successfully.
exit code: 1
[9 lines of output]
Traceback (most recent call last):
File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-9e2mdrtx\overlay\lib\python3.10\site-packages\skbuild\setuptools_wrap.py", line 645, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-9e2mdrtx\overlay\lib\python3.10\site-packages\skbuild\cmaker.py", line 148, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-9e2mdrtx\overlay\lib\python3.10\site-packages\skbuild\cmaker.py", line 105, in get_cmake_version
raise SKBuildError(msg) from err
Problem with the CMake installation, aborting build. CMake executable is cmake
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects
[end of output]
注意:此错误源自子进程,并且可能不是 pip 的问题。 错误:子进程退出并出现错误
× 用于安装后端依赖项的 pip 子进程未成功运行。 │ 退出代码:1 ╰─> 请参阅上面的输出。
注意:此错误源自子进程,并且可能不是 pip 的问题。
谁能告诉我问题是什么?以及如何修复它
您可以尝试以下一些步骤来解决此问题:
1 - 升级点
pip install --upgrade pip
2-安装CMake
apt-get install cmake
3-升级设置工具和滚轮
pip install --upgrade setuptools wheel
4-安装numpy:尝试再次安装numpy:
pip install numpy
Pip 未能安装软件包
ninja
,这是您使用所必需的numpy
。
消息如下:
Failed building wheel for ninja
它还说由于
CMake
的错误而失败。
消息如下:
Problem with the CMake installation, aborting build.
要解决此问题,请尝试使用以下行安装
CMake
和 build-essential
: apt-get install cmake build-essential
.