错误:为numpy构建轮子失败,错误:无法为numpy构建wheels,这是安装基于pyproject.toml的项目所必需的

ny6fqffe  于 2023-06-23  发布在  其他
关注(0)|答案(4)|浏览(617)

我使用python poetry(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来解决它,尽管这对我不起作用。

qoefvg9y

qoefvg9y1#

我通过以下步骤解决了这个问题:
1.我用pip install numpy命令安装的numpy版本更新了pyproject.toml(这个文件包含所有的库/依赖项/dev依赖项)。

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

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

  • 简而言之,你只需要安装正确版本的numpy Click me来检查兼容性
  • 然后使用pip install numpy==version安装所需的版本。
    **示例:**安装NumPy 1.23.5版本,请使用-pip install numpy==1.23.5

如果你有任何问题,你可以发表评论。我会试着回答。

htzpubme

htzpubme2#

我尝试在macOS上安装numpy和PyPy。
我通过首先运行brew doctor解决了这个问题,这表明我的命令行工具(XCode)已经过时了。然后我只是按照说明更新它们:

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

这解决了问题。
我的配置:

  • macOS 12.2.1 Monterey
> 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)]
ss2ws0br

ss2ws0br3#

我通过安装正确版本的numpy解决了这个问题,在这里检查兼容性https://matplotlib.org/stable/devel/min_dep_policy.html
然后通过pip 3 install -v numpy==[version]安装

cbeh67ev

cbeh67ev4#

Numpy错误解决

Error: failed to build wheels for numpy which is required to install project.tmol

此错误原因是由于过时的numpy版本只需运行此命令
MATHLAB =“m”pip install numpy

**我的python版本:**Python -V=3.9

  • 在某些情况下它不起作用,但大多数时间都起作用 *
    **如果你使用的是venv,那么尝试在venv中安装numpy。**然后运行你的代码,它将正常工作

相关问题