我正在尝试使用pip为我正在构建的语音助手项目安装pyAudio。当我尝试运行代码时,它返回此错误,并没有名为“pyaudio”的模块。所以我假设我必须再次安装pyaudio才能使其正常工作。
但在安装pyaudio时,我遇到了这个错误。我尝试了许多方法,如安装portaudio、清除pip缓存、更新、卸载、重新安装包、pip和python。
我是python新手,所以请不要介意这是新手犯的错误。
macOS 12.3.1、Python 3.9.1、env虚拟环境
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.
试试这个:
sudo apt-get install portaudio19-dev
然后重试
在python的venv终端中,我尝试使用pip安装pyaudio。我继续得到以下错误:
问题内容: 尝试使用安装软件包时显示错误,而其他软件包正在正常安装。我正在使用python 3.7。为什么会发生此错误? 问题答案: 在运行python 3.6时,此方法有效,但在python 3.7中则无效。 PyAudio仅支持python 3.6: pip将获取并安装PyAudio滚轮(预包装的二进制文件)。当前,有一些轮子与Python 2.7、3.4、3.5和3.6的官方发行版兼容。 解
我在乌班图系统上安装名为“bcrypt”的npm软件包时遇到问题。 这就是我所做的: sudo apt-get更新< br> sudo apt-get安装节点js sudo apt-get安装npm sudo npm安装bcrypt 这是我得到的: 键入时: sudo npm 安装 bcrypt 包不会放在此文件夹中: /home/gatsu/salongapp/salongapp/node_mo
问题内容: 当我试图安装使用,我得到的错误。看起来像这样: 知道这里发生了什么吗? 问题答案: 尝试以下操作(在管理员模式命令提示符下): pipwin就像pip一样,但是它安装了Christoph Gohlke提供的预编译的Windows二进制文件。为您节省大量的Google搜寻和手动下载。
问题内容: 我正在尝试编写一个程序来记录计算机麦克风中的信息,然后将其保存到文件中。似乎是执行此操作的较好软件包之一,并且它们甚至都具有Windows 7(Python 2.7)的二进制文件。我下载了可执行文件并运行它来设置PyAudio,但是当我尝试将PyAudio导入python脚本时,出现了一个错误: 如果我看pyaudio.py,它失败的代码是: 另外,如果相关的话,如果我转到pyaudi