簡體   English   中英

一輩子都無法在我的 M1Pro Macbook Pro 上安裝 portaudio

[英]Cannot for the life of me get portaudio install on my M1Pro Macbook Pro

    sudo -H pip install pyaudio --global-option="build_ext" --global-option="-I/opt/homebrew/include" --global-option="-L/opt/homebrew/lib"
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Collecting pyaudio
  Downloading PyAudio-0.2.12.tar.gz (42 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.9/42.9 kB 872.0 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... 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-12-arm64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-12-arm64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-12-arm64-cpython-39
      creating build/temp.macosx-12-arm64-cpython-39/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -DMACOSX=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-12-arm64-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

當我運行命令時,無論如何 - pip install pyaudio,或者上面帶有/不帶 sudo 的命令,它總是給出相同的錯誤。 我看到這是一個非常普遍的問題。 我仔細檢查了命令中使用的目錄中的路徑和端口。 我很茫然,真的不明白為什么它不起作用。 我還嘗試直接從文件本身構建 pyaudio,但它仍然無法正常工作。 有沒有人有什么建議?

已解決:我發現了這個: https://qiita.com/yukilab/items/d50a10f1d46c44ae0757

即使它是另一種語言,我也能夠讓它工作。 它類似於@Bob th 的建議,但略有不同。

本質上,我制作了一個 file.pydistutils.cfg 並添加了

    [build_ext]
include_dirs=/opt/homebrew/include
library_dirs=/opt/homebrew/lib

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM