CentOS7 安裝 PyAudio 發生錯誤[解決]
執行
pip install PyAudio
如果出現以下次錯誤
Collecting PyAudio
Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (setup.py) ... error
ERROR: Complete output from command /opt/rh/rh-python36/root/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-aqdgoicv/PyAudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3dqdycqf --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
原因在於,需要安裝 portaudio ,解決方式如下:
wget http://portaudio.com/archives/pa_stable_v190600_20161030.tgz
tar -xvf pa_stable_v190600_20161030.tgz
cd portaudio
./configure
接著在執行安裝,應該就會正常
pip install PyAudio