【问题标题】:error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 while installing pygsr,pyaudio错误:安装 pygsr、pyaudio 时命令“x86_64-linux-gnu-gcc”失败,退出状态为 1
【发布时间】:2017-03-14 10:12:52
【问题描述】:

我在 Ubuntu 16.04 LTS 中使用 Python 2.7.12。我尝试使用命令安装pyaudiopygsr

sudo pip install -U pyaudio
sudo pip install -U pygsr

我得到如下输出(错误):

    Collecting pyaudio
  Downloading PyAudio-0.2.10.tar.gz (287kB)
    100% |████████████████████████████████| 296kB 762kB/s 
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Unc_F6/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2uTcg2-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    copying src/pyaudio.py -> build/lib.linux-x86_64-2.7
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-2.7/src/_portaudiomodule.o
    src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Unc_F6/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-2uTcg2-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Unc_F6/pyaudio/

【问题讨论】:

标签: python linux gcc


【解决方案1】:

嗯,我用包管理器解决了这个问题,

 $ sudo apt-get install python-pyaudio

虽然仍然不知道为什么easy_install会失败。

【讨论】:

  • 'pygsr' 模块怎么样..??
  • 它包含在包装中:)
  • 如果错误仍然存​​在,试试这个链接pypi.python.org/pypi/pygsr :)
  • 当我导入“pygsr”时,它会抛出类似“ImportError: No module named pygsr”的错误
【解决方案2】:

我通过在 ubuntu 16.04 上使用以下命令解决了这个问题。在 python 3.7 和 3.5 上测试

sudo apt install portaudio19-dev python-pyaudio
pip install PyAudio

【讨论】:

  • 谢谢!它在 Ubuntu 20.04 上与 sudo apt install portaudio19-dev python3-pyaudio 一起工作
猜你喜欢
  • 2016-08-27
  • 1970-01-01
  • 2016-01-08
  • 2017-05-20
  • 2016-04-18
  • 2014-11-21
  • 1970-01-01
  • 1970-01-01
  • 2015-01-23
相关资源
最近更新 更多