【问题标题】:Can't install PyAudio on GAE Flexible Environment(Python)无法在 GAE 灵活环境(Python)上安装 PyAudio
【发布时间】:2018-01-30 23:07:11
【问题描述】:

所以我在获取这个烧瓶后端时遇到了很多问题。除了一些识别从前端传递的音频的逻辑之外,它是非常标准的东西。为此,我合并了 PyDejaVu。

其中一个依赖项(PyAudio)未正确构建。其他一切都很好。

这里有一些日志:

Step #1:    #include "portaudio.h"
Step #1:                          ^
Step #1:   compilation terminated.
Step #1:   error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Step #1:   Failed building wheel for PyAudio

Command "/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-arQ8b7/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-4yefCE-record/install-record.txt --single-version-externally-managed --compile --install-headers /env/include/site/python2.7/PyAudio" failed with error code 1 in /tmp/pip-build-arQ8b7/PyAudio/
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud-builders/docker@sha256:0d9f13d75152530e2ee49bf3a3be3d6198b946f7315b3961994355a7aaee2925" failed: exit status 1
Step #1: 
------------

requirements.txt

PyAudio==0.2.9
PyDejaVu==0.1.3
werkzeug==0.14.1
flask-cors==2.1.2
flask-login==0.3.2
flask-oauthlib==0.9.2
flask-restful==0.3.5
flask-wtf==0.12
flask==0.12.2
flask-sqlalchemy==0.9
numpy==1.13.3
gunicorn==19.7.1

我遵循了错误,显然我必须通过 apt-get 安装 port-audio,但这显然是不可能的。

感谢任何帮助!

【问题讨论】:

标签: python google-app-engine pyaudio


【解决方案1】:

由于 App Engine flex 基于 docker,您必须从 Dockerfile 安装依赖项。在这种情况下,您必须自定义 App Engine Python Dockerfile 以添加 PyAudio 可能需要的所有库。您可以查看一些包含 PyAudio Sample1Sample2 的 Dockerfile。

我可以通过在 Dockerfile 中添加以下依赖项和库来解决错误:

RUN apt-get update && apt-get install -y \
        vim \
        curl \
        wget \
        git \
        make \
        netcat \
        python \
        python2.7-dev \
        g++ \
        bzip2 \
        binutils
###############################################################################
RUN apt-get install -y portaudio19-dev libopenblas-base libopenblas-dev pkg-config git-core cmake python-dev liblapack-dev libatlas-base-dev libblitz0-dev libboost-all-dev libhdf5-serial-dev libqt4-dev libsvm-dev libvlfeat-dev  python-nose python-setuptools python-imaging build-essential libmatio-dev python-sphinx python-matplotlib python-scipy
# additional dependencies
RUN apt-get install -y \
        libasound2 \
        libasound-dev \
        libssl-dev

RUN pip install pyaudio

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-07
    • 2020-03-27
    • 1970-01-01
    • 1970-01-01
    • 2021-11-15
    • 1970-01-01
    • 1970-01-01
    • 2021-09-15
    相关资源
    最近更新 更多