【问题标题】:ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects错误:无法为 pyaudio 构建轮子,这是安装基于 pyproject.toml 的项目所必需的
【发布时间】:2022-08-17 22:18:51
【问题描述】:

尝试安装 PyAudio 时出现此错误:

ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

有谁知道为什么会发生这种情况以及如何解决?

最好的

  • 始终将有问题的完整错误消息(从单词 \"Traceback\" 开始)(不在 cmets 中)作为文本(不是屏幕截图,不链接到外部门户)。完整的错误/回溯中还有其他有用的信息。
  • 当您运行pip 时,您可以使用选项-v(如verbose)在pip 显示错误时查看更多信息。如果没有 FULL 错误,很难说是什么问题。据我所知PyAudio 可能会使用一些 C/C++ 代码,并且可能会出现编译问题。它可能需要使用homebrew 来安装一些带有文件.h 的C/C++ 库或C/C++ 源代码。但这一切都需要更多关于错误的信息。或者您应该使用PyAudio 检查有关此问题的其他问题
  • 嗨@furas 感谢您的回复-我在下面包含了完整的消息
  • Acredito que esse link pode lhe ajudar PyAudio

标签: python homebrew pyproject.toml


【解决方案1】:

感谢您的写作。错误代码很长 - 但它是:

Collecting pyaudio
  Using cached PyAudio-0.2.12.tar.gz (42 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/dn/opt/anaconda3/include -arch x86_64 -I/Users/dn/opt/anaconda3/include -fPIC -O2 -isystem /Users/dn/opt/anaconda3/include -arch x86_64 -DMACOSX=1 -I/usr/local/include -I/usr/include -I/Users/dn/opt/anaconda3/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
      src/_portaudiomodule.c:31:10: fatal error: 'portaudio.h' file not found
      #include "portaudio.h"
               ^~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
Note: you may need to restart the kernel to use updated packages.

我尝试重新启动内核但无济于事

【讨论】:

    【解决方案2】:

    【讨论】:

    • 用文字回答问题,而不是截图
    【解决方案3】:

    我也有同样的问题,但是用的是linux。相反,来自 google colab。我一直在尝试制作一个包含该库的笔记本,但我遇到了几乎相同的错误。有什么解决办法吗?这是笔记本:https://colab.research.google.com/drive/1_AUmdP63b43RbtIoefMTBhLVDhMggCjv?usp=sharing

    【讨论】:

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