0

Не могу установить PyAudio.

os linux ubuntu 20.04

Выдает ошибку:

  Using cached PyAudio-0.2.11.tar.gz (37 kB)
  Preparing metadata (setup.py) ... done
  Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
      running build_ext
      building '_portaudio' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare     -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/archery/PycharmProjects/Asist/venv/include -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
  src/_portaudiomodule.c:28:10: fatal error: Python.h: Нет такого файла или   каталога
     28 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem     with pip.
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
  Running setup.py install for pyaudio ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyaudio did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.9
      copying src/pyaudio.py -> build/lib.linux-x86_64-3.9
      running build_ext
      building '_portaudio' extension
      creating build/temp.linux-x86_64-3.9
      creating build/temp.linux-x86_64-3.9/src
       x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/archery/PycharmProjects/Asist/venv/include -I/usr/include/python3.9 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.9/src/_portaudiomodule.o
  src/_portaudiomodule.c:28:10: fatal error: Python.h: Нет такого файла или каталога
     28 | #include "Python.h"
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem  with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyaudio

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Буду благодарен за ответ

1

1 ответ 1

0

Вы бы указали бы, как вообще запускаете, какая версия Python и т.д. (совет, как улучшить текст, чтобы вопросов дополнительных не возникало бы).

Ну да ладно. Вот у вас видно fatal error: Python.h: Нет такого файла или каталога про директиву #include "Python.h". А это значит, что вам необходимо установить пакет в систему с помощью следующей команды

sudo apt-get install python3-dev

А после установки данного пакета попробуйте еще раз.

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.