質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

Q&A

解決済

1回答

5649閲覧

pyaudioのインストールができない

aaaa____

総合スコア26

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

0グッド

0クリップ

投稿2022/10/03 12:58

環境

macOS Big Sur ver.12.6 (21G115)
MacBook Air M1, 2020
8GB
Homebreq ver.3.6.3(git revision 86ac48865b7; last commit 2022-10-02)
Python 3.10.6
pip 22.2.2 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)

エラー内容

MacBook-Air ~ % pip3 install pyaudio 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 ╰─> [18 lines of output] Error in sitecustomize; set PYTHONVERBOSE for traceback: AssertionError: running bdist_wheel running build running build_py creating build creating build/lib.macosx-11-arm64-cpython-310 copying src/pyaudio.py -> build/lib.macosx-11-arm64-cpython-310 running build_ext building '_portaudio' extension creating build/temp.macosx-11-arm64-cpython-310 creating build/temp.macosx-11-arm64-cpython-310/src clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -DMACOSX=1 -I/usr/local/include -I/usr/include -I/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/_portaudiomodule.c -o build/temp.macosx-11-arm64-cpython-310/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

やったこと

ひとまず最後のところのエラー文を検索にかけて
https://stackoverflow.com/questions/73268630/error-could-not-build-wheels-for-pyaudio-which-is-required-to-install-pyprojec
このサイトを見ました.

sudo apt install portaudio19-dev

をするように書いてあり,Homebrewに対して同じような操作を行うために.

brew install portaudio19-dev

をしてみたのですが.

MacBook-Air ~ % brew install portaudio19-dev Running `brew update --auto-update`... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> New Formulae jj netcdf-cxx rome mycorrhiza netcdf-fortran tbls You have 3 outdated formulae installed. You can upgrade them with brew upgrade or list them with brew outdated. ==> Tapping homebrew/cask Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'... remote: Enumerating objects: 675808, done. remote: Counting objects: 100% (19/19), done. remote: Compressing objects: 100% (19/19), done. remote: Total 675808 (delta 8), reused 9 (delta 0), pack-reused 675789 Receiving objects: 100% (675808/675808), 320.53 MiB | 6.26 MiB/s, done. Resolving deltas: 100% (479579/479579), done. Tapped 4083 casks (4,155 files, 342MB). Warning: No available formula with the name "portaudio19-dev". Did you mean portaudio? ==> Searching for similarly named formulae... This similarly named formula was found: portaudio ✔ To install it, run: brew install portaudio ✔ ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps.

のようになってしまいました.

他にも調べてみると,Pythonのバージョンが3.7以上だと非公式の
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
に取りにいかなければいけないとあったのですが,どれをダウンロードすべきなのかわかりませんでした.

pyaudioを正しくインストールするのはどうすれば良いのでしょうか.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

https://qiita.com/yukilab/items/d50a10f1d46c44ae0757
とか。

shell

1CPPFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib" pip install pyaudio

とかしてもいいです。

C言語のビルドの知識が要りますよ。

投稿2022/10/03 13:49

quickquip

総合スコア11038

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

aaaa____

2022/10/05 12:17

[build_ext] include_dirs=/opt/homebrew/include library_dirs=/opt/homebrew/lib を書いた後に pip3 install pyaudioしたらできました.ありがとうございます.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問