python - 我尝试在我的 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('"'"'\r\n'"'"', '"'"'\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('"'"'\r\n'"'"', '"'"'\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
推荐阅读
- java - 在启动时使用谷歌计费检查购买
- java - Logback 和 Graylog 无法在 Mac 上使用 syslog 进行通信
- python - Selenium WebDriver 异常:消息:未知错误:无法创建 Chrome 进程
- c++ - 是什么导致 GCC 4.8 中出现这个未定义的引用?
- azure - 是否可以使用 mendel linux 在珊瑚开发板上运行 azure Iotedge?
- reactjs - 即使有 onChange 方法,为什么我们还要将 `value` 设置为我们的状态
- ios - SwiftUI:如何使用延迟为两个图像之间的过渡设置动画?
- postgresql - PL/PGSQL触发器如何检测UPDATE上的SQL语句中是否提供了列?
- python - 无法使用 spyder 安装 pdflatex
- linux - MOTD 脚本不显示颜色