当我尝试在我的Linux Mint上安装pyaudio时,我遇到了错误



这是以下错误:

Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: /home/gameologist/PycharmProjects/virtualassistant/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xtvkc0zh/pyaudio_4534e484b2cf48c7be3c983e99506f2c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xtvkc0zh/pyaudio_4534e484b2cf48c7be3c983e99506f2c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vo7m84xe/install-record.txt --single-version-externally-managed --compile --install-headers /home/gameologist/PycharmProjects/virtualassistant/venv/include/site/python3.6/pyaudio
cwd: /tmp/pip-install-xtvkc0zh/pyaudio_4534e484b2cf48c7be3c983e99506f2c/
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying src/pyaudio.py -> build/lib.linux-x86_64-3.6
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/gameologist/PycharmProjects/virtualassistant/venv/include -I/usr/include/python3.6m -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.6/src/_portaudiomodule.o
src/_portaudiomodule.c:28:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/gameologist/PycharmProjects/virtualassistant/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xtvkc0zh/pyaudio_4534e484b2cf48c7be3c983e99506f2c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xtvkc0zh/pyaudio_4534e484b2cf48c7be3c983e99506f2c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vo7m84xe/install-record.txt --single-version-externally-managed --compile --install-headers /home/gameologist/PycharmProjects/virtualassistant/venv/include/site/python3.6/pyaudio Check the logs for full command output.

我什么都试过了。。。。但我还是犯了同样的错误!!

我在WSL中遇到了同样的问题。正在获取错误:

  • 'wheel' is not installed
  • Python.h: No such file or directory
  • portaudio.h: No such file or directory

通过安装以下系统包解决了此问题:

  • python3-dev
  • python-wheel-common
  • portaudio19-dev
$ sudo apt install python3-dev python-wheel-common portaudio19-dev

最新更新