ModuleNotFoundError: No module named 'pyaudio'

Building wheels for collected packages: PyAudio
  Building wheel for PyAudio (setup.py) ... error
  ERROR: Complete output from command /home/robot/anaconda3/envs/homeassistant/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ooplakmw/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-egeb28e6 --python-tag cp37:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  copying src/pyaudio.py -> build/lib.linux-x86_64-3.7
  running build_ext
  building '_portaudio' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/src
  gcc -pthread -B /home/robot/anaconda3/envs/homeassistant/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/robot/anaconda3/envs/homeassistant/include/python3.7m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.7/src/_portaudiomodule.o
  src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
   #include "portaudio.h"
                         ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for PyAudio
  Running setup.py clean for PyAudio
Failed to build PyAudio

 

 

 

解决办法:

“Debian / Ubuntu注意:请务必事先安装portaudio库开发包(portaudio19-dev)和python开发包(python-all-dev)。” -- people.csail.mit.edu/hubert/pyaudio -
 

sudo apt-get install python-all-dev 

sudo apt-get install portaudio19-dev

然后在安装:

pip install pyaudio

修复了这个问题 

你可能感兴趣的:(智能家居,Arduino)