Vis*_*mar 8 homebrew pip portaudio pyaudio macos-big-sur
我访问了很多论坛,尝试了不同的方法,如brew、pip、port 等等,但仍然面临同样的错误。
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
sel*_*ted 36
这些步骤适用于 M1 Pro 芯片
portaudio
brew install portaudio
Run Code Online (Sandbox Code Playgroud)
portaudio
brew link portaudio
Run Code Online (Sandbox Code Playgroud)
portaudio
(下一步使用)brew --prefix portaudio
Run Code Online (Sandbox Code Playgroud)
.pydistutils.cfg
在你的主目录中创建sudo nano $HOME/.pydistutils.cfg
Run Code Online (Sandbox Code Playgroud)
然后粘贴以下内容
[build_ext]
include_dirs=<PATH FROM STEP 3>/include/
library_dirs=<PATH FROM STEP 3>/lib/
Run Code Online (Sandbox Code Playgroud)
pip install pyaudio
or
pip3 install pyaudio
Run Code Online (Sandbox Code Playgroud)
小智 12
对我来说是:
brew install portaudio
python -m pip install --global-option='build_ext' --global-option='-I/opt/homebrew/Cellar/portaudio/19.7.0/include' --global-option='-L/opt/homebrew/Cellar/portaudio/19.7.0/lib' pyaudio
Run Code Online (Sandbox Code Playgroud)
小智 6
该解决方案已在 M1 Mac 上进行测试[请与其他解决方案核实]。
在系统上安装 HomeBrew 后,执行PortAudio的安装。接下来按照下面提到的步骤操作:
使用命令安装PortAudio
须藤酿造安装portaudio
成功安装PortAudio后,输入以下命令。
sudo nano $HOME/.pydistutils.cfg
接下来,在打开的窗口中输入以下行
[build_ext]
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/include/
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/lib/
Run Code Online (Sandbox Code Playgroud)
注意:PortAudio 的位置可能与您不同,也不要忘记替换您的 PC 用户名。
最后运行命令
pip 安装 pyaudio
或者
pip3安装pyaudio
归档时间: |
|
查看次数: |
16698 次 |
最近记录: |