【问题标题】:ERROR: Failed building wheel for numpy , ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects错误:为 numpy 构建轮子失败,错误:无法为 numpy 构建轮子,这是安装基于 pyproject.toml 的项目所必需的
【发布时间】:2022-01-03 12:43:29
【问题描述】:

我在我的项目中使用 python 诗歌(https://python-poetry.org/) 进行依赖管理。

虽然当我运行poetry install 时,它给了我以下错误。

ERROR: Failed building wheel for numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

我的笔记本电脑上安装了 python 3.9。
我使用pip install numpy 安装了 numpy 1.21.5,我什至尝试将其版本降低到 1.19.5。

虽然我遇到了同样的错误。

我发现很多人在 python 3.10 中遇到 ERROR: Failed building wheel for numpy 这个错误,他们通过将 python 版本降低到 3.9 来解决它,尽管这对我没有用。

【问题讨论】:

  • 有同样的问题。你能解决这个问题吗?

标签: python macos numpy python-poetry


【解决方案1】:

我通过以下步骤解决了它:-

  1. 我用我使用pip install numpy 命令安装的 numpy 版本更新了 pyproject.toml(此文件包含所有库/依赖项/dev 依赖项)。

  2. 运行poetry lock 更新poetry.lock 文件(包含有关库的详细信息)

  3. 再次运行poetry install,它应该可以正常工作。

如果您有任何问题,您可以发表评论。 我会尽量回答。

【讨论】:

    【解决方案2】:

    我试图在 macOS 上使用 PyPy 安装 numpy。

    我通过首先运行 brew doctor 解决了这个问题,这表明我的命令行工具 (XCode) 已过时。然后我只是按照说明更新它们:

    sudo rm -rf /Library/Developer/CommandLineTools
    sudo xcode-select --install
    

    这解决了问题。


    我的配置:

    • macOS 12.2.1 蒙特雷
    > python --version
    Python 3.8.12 (9ef55f6fc369, Oct 25 2021, 05:10:01)
    [PyPy 7.3.7 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.3)]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-22
      • 2022-01-09
      • 1970-01-01
      • 2022-06-29
      • 2022-11-20
      • 2022-11-24
      • 2022-08-06
      • 2022-11-08
      相关资源
      最近更新 更多