【问题标题】:I got an error while I'm trying to install pyaudio on my Linux Mint我尝试在我的 Linux Mint 上安装 pyaudio 时出错
【发布时间】:2021-06-14 13:17:54
【问题描述】:

这是以下错误:

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.

我尝试了一切......但我仍然得到同样的错误!

【问题讨论】:

  • 欢迎来到 Stack Overflow。当您尝试安装时,您正在运行什么命令?
  • 是否安装了以下软件包 python3-devbuild-essential ?如果没有,请尝试使用 apt-get 安装它们并再次尝试安装 pyaudio。

标签: python python-3.x linux pycharm pyaudio


【解决方案1】:

我在 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-08
    • 2015-12-23
    • 1970-01-01
    • 1970-01-01
    • 2011-11-28
    • 2018-02-02
    • 1970-01-01
    • 2018-10-21
    相关资源
    最近更新 更多