1

我正在尝试使用 Conda 安装 SimpleAudio,尽管我遇到了错误。然后我尝试 Pip 并得到一个不同的错误。我正在使用 python 版本 3.6.6 在 Raspberry Pi 4 上运行 Raspbian Buster。康达版本 4.5.1。点子版本 18.0。处理器是 ARM Cortex-A72。

我使用以下方式安装 SimpleAudio:

conda install -c skmad simpleaudio

然后我收到以下错误:

Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - simpleaudio

Current channels:

  - https://conda.anaconda.org/skmad/linux-armv7l
  - https://conda.anaconda.org/skmad/noarch
  - https://conda.anaconda.org/rpi/linux-armv7l
  - https://conda.anaconda.org/rpi/noarch
  - https://repo.anaconda.com/pkgs/main/linux-armv7l
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/free/linux-armv7l
  - https://repo.anaconda.com/pkgs/free/noarch
  - https://repo.anaconda.com/pkgs/r/linux-armv7l
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/pro/linux-armv7l
  - https://repo.anaconda.com/pkgs/pro/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

尽管 Annaconda 网站上建议了我运行的脚本,但我仍收到此错误。

然后我尝试通用 pip install (找到正确的包)并获得以下过程和错误消息:

pi@raspberrypi:~ $ pip install simpleaudio

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting simpleaudio
  Using cached https://files.pythonhosted.org/packages/94/1b/4dc29653733202b68c09d9c6ca085cf67ac54859ee860647ef21ac1ff3dc/simpleaudio-1.0.4.tar.gz
Building wheels for collected packages: simpleaudio
  Running setup.py bdist_wheel for simpleaudio ... error
  Complete output from command /home/pi/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ll1gm7ko/simpleaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-u1mh9fbx --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.6
  creating build/lib.linux-armv7l-3.6/simpleaudio
  copying simpleaudio/__init__.py -> build/lib.linux-armv7l-3.6/simpleaudio
  copying simpleaudio/shiny.py -> build/lib.linux-armv7l-3.6/simpleaudio
  copying simpleaudio/functionchecks.py -> build/lib.linux-armv7l-3.6/simpleaudio
  creating build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  copying simpleaudio/test_audio/c.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  copying simpleaudio/test_audio/e.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  copying simpleaudio/test_audio/g.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  copying simpleaudio/test_audio/left_right.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  copying simpleaudio/test_audio/notes_2_16_44.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
  running build_ext
  building 'simpleaudio._simpleaudio' extension
  creating build/temp.linux-armv7l-3.6
  creating build/temp.linux-armv7l-3.6/c_src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/pi/miniconda3/include -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -fPIC -O2 -pipe -I/home/pi/miniconda3/include -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -fPIC -O2 -pipe -fPIC -DDEBUG=0 -I/home/pi/miniconda3/include/python3.6m -c c_src/simpleaudio_alsa.c -o build/temp.linux-armv7l-3.6/c_src/simpleaudio_alsa.o
  c_src/simpleaudio_alsa.c:8:10: fatal error: alsa/asoundlib.h: No such file or directory
   #include <alsa/asoundlib.h>
            ^~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for simpleaudio
  Running setup.py clean for simpleaudio
Failed to build simpleaudio
Installing collected packages: simpleaudio
  Running setup.py install for simpleaudio ... error
    Complete output from command /home/pi/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ll1gm7ko/simpleaudio/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-record-fmdsq71s/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.6
    creating build/lib.linux-armv7l-3.6/simpleaudio
    copying simpleaudio/__init__.py -> build/lib.linux-armv7l-3.6/simpleaudio
    copying simpleaudio/shiny.py -> build/lib.linux-armv7l-3.6/simpleaudio
    copying simpleaudio/functionchecks.py -> build/lib.linux-armv7l-3.6/simpleaudio
    creating build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/c.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/e.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/g.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/left_right.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    copying simpleaudio/test_audio/notes_2_16_44.wav -> build/lib.linux-armv7l-3.6/simpleaudio/test_audio
    running build_ext
    building 'simpleaudio._simpleaudio' extension
    creating build/temp.linux-armv7l-3.6
    creating build/temp.linux-armv7l-3.6/c_src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/pi/miniconda3/include -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -fPIC -O2 -pipe -I/home/pi/miniconda3/include -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -fPIC -O2 -pipe -fPIC -DDEBUG=0 -I/home/pi/miniconda3/include/python3.6m -c c_src/simpleaudio_alsa.c -o build/temp.linux-armv7l-3.6/c_src/simpleaudio_alsa.o
    c_src/simpleaudio_alsa.c:8:10: fatal error: alsa/asoundlib.h: No such file or directory
     #include <alsa/asoundlib.h>
              ^~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/pi/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ll1gm7ko/simpleaudio/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-record-fmdsq71s/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ll1gm7ko/simpleaudio/

有没有人有什么建议?

谢谢

4

1 回答 1

4

通过在使用 Pip 之前安装所需的依赖项解决了这个问题。

使用以下脚本:

sudo apt-get install -y python3-dev libasound2-dev
于 2020-02-19T16:40:25.233 回答