首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法安装pyAudio

无法安装pyAudio
EN

Stack Overflow用户
提问于 2022-05-21 04:39:03
回答 1查看 124关注 0票数 -2

我正在为我正在构建的语音助理项目使用pip安装pyAudio。当我试图运行代码时,它会返回这个错误,它说没有名为‘py音频’的模块。因此,我认为我必须再次安装吡咯烷酮,以使其工作。

但是在安装py音频的时候,我得到了这个错误。我尝试过许多方法,如安装port音频、清除pip缓存、更新、卸载、重新安装包、pip和python。

我是刚接触python的仙女,所以请不要介意这是新手的错误。

macOS 12.3.1,Python3.9.1,env虚拟环境

代码语言:javascript
复制
Collecting pyaudio
  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
  ╰─> [13 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/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
  ╰─> [15 lines of output]
      running install
      /Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      copying src/pyaudio.py -> build/lib.macosx-10.9-x86_64-cpython-39
      running build_ext
      building '_portaudio' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DMACOSX=1 -I/Users/setukumar/Downloads/Virtual-Personal-Assistant-using-Python-master/env/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_portaudiomodule.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/_portaudiomodule.o
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/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.
EN

回答 1

Stack Overflow用户

发布于 2022-05-21 04:47:14

试试这个:

代码语言:javascript
复制
sudo apt-get install portaudio19-dev

然后再试一次

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72326708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档