首页 > 解决方案 > pip安装命令如何解决

问题描述

我对 python 语音识别问题和音频库有疑问

这是在windows系统上

import speach_recognition as sr
r =sr.Recognizer()
with sr.Microphone() as source:
print("Speak Anything")
audio = r.listen(source)

 try:
    text = r.recognize_google(audio)
    print('you said : {}'.format(text))
except:
    print('sorry could not recognized voice')

C:\Users\DELL> pip install audio 收集音频 使用缓存 的https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz 收集包的构建轮:音频构建轮对于 pyaudio (setup.py) ... 错误 ERROR: Complete output from command 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import setuptools, tokenize; 文件='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-1gm3suw5\pyaudio\setup.py'"'"``';f=getattr(tokenize, '"'"' open'"'"', open)( file );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'", '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\DELL\AppData\Local\Temp\pip-wheel-ke5zzs2d' --python-tag cp37: ERROR: running bdist_wheel running构建运行 build_py 创建构建创建 build\lib.win-amd64-3.7
复制 src\pyaudio.py -> build\lib.win-amd64-3.7 运行 build_ext 构建 '_portaudio' 扩展错误:需要 Microsoft Visual C++ 14.0。使用“Microsoft Visual C++ 构建工具”获取它: https ://visualstudio.microsoft.com/downloads/
---------------------------------------- 错误:pyaudio 运行设置的构建轮失败。 pyaudio 的 py clean 无法构建 pyaudio 安装收集的软件包:pyaudio Running setup.py install for audio ... 错误错误:命令“C:\ProgramData\Anaconda3\python.exe”的完整输出 -u -c 'import setuptools,标记化;file ='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-1gm3suw5\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open' "'"', open)( file );code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"'); f.close();exec(编译(代码、文件, '"'"'exec'"'"'))' install --record 'C:\Users\DELL\AppData\Local\Temp\pip-record-e6fzeo61\install-record.txt' --single-version -externally-managed --compile: 错误: running install running build running build_py 创建 build 创建 build\lib.win-amd64-3.7 复制 src\pyaudio.py -> build\lib.win-amd64-3.7 running build_ext building '_portaudio ' 扩展错误:需要 Microsoft Visual C++ 14.0。使用“Microsoft Visual C++ 构建工具”获取它: https ://visualstudio.microsoft.com/downloads/ ------------- ------------- 错误:命令“'C:\ProgramData\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;文件='"'"'C:\Users\DELL\AppData\Local\Temp\pip-install-1gm3suw5\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'" '"', 打开)(文件);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f .close();exec(compile(code, file , '"'"'exec'"'"'))' install --record 'C:\Users\DELL\AppData\Local\Temp\pip-record-e6fzeo61 \install-record.txt' --single-version-externally-managed --compile" 失败,错误代码 1 在 C:\Users\DELL\AppData\Local\Temp\pip-install-1gm3suw5\pyaudio\

标签: python-3.xspeech-recognitionspeech-to-text

解决方案


正如您的错误所示:

Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

您需要安装 MS Visual C++ 14.0 编译器,以便构建 C++ 依赖项(详细说明here)。

另一种选择是(根据this answer的建议)使用来自Unofficial Windows Binaries for Python Extension Packages的 Python 包的已编译 Windows 依赖项的非官方库。


推荐阅读