如何解决pip安装命令

时间:2019-07-12 12:27:46

标签: python-3.x speech-recognition speech-to-text

我对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安装音频使用缓存来收集音频   https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz   用于收集包装的建筑轮子:音频建筑轮子   pyaudio(setup.py)...错误错误:命令的完整输出   'C:\ ProgramData \ Anaconda3 \ python.exe'-u -c'导入安装程序工具,   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'“'”')))'   bdist_wheel -d'C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-wheel-ke5zzs2d'   --python-tag cp37:错误:运行bdist_wheel运行构建运行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的构建轮失败运行设置。 py clean for pyaudio无法建立   pyaudio安装收集的软件包:pyaudio运行setup.py   安装音频...错误       错误:命令'C:\ ProgramData \ Anaconda3 \ python.exe'-u -c'import setuptools的完整输出,   tokenize; 文件 ='“'”'C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-install-1gm3suw5 \ pyaudio \ setup.py'“'”'; f = getattr(标记化,   '“”“'open'”'“,打开)(文件); code = f.read()。replace('”'“'\ r \ n'”'“',   '“'”'\\ n'“'”'); f.close(); exec(compile(code, file ,'“'”'exec'“'”')))'   安装-记录   'C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-record-e6fzeo61 \ install-record.txt'   -单一版本-外部管理-编译:       错误:正在运行安装       运行构建       运行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/       ----------------------------------------错误:命令“'C:\ ProgramData \ Anaconda3 \ python.exe'-u -c'导入设置工具,   tokenize; 文件 ='“'”'C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-install-1gm3suw5 \ pyaudio \ setup.py'“'”'; f = getattr(标记化,   '“”“'open'”'“,打开)(文件); code = f.read()。replace('”'“'\ r \ n'”'“',   '“'”'\\ n'“'”'); f.close(); exec(compile(code, file ,'“'”'exec'“'”')))'   安装-记录   'C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-record-e6fzeo61 \ install-record.txt'   --single-version-externally-managed --compile“在C:\ Users \ DELL \ AppData \ Local \ Temp \ pip-install-1gm3suw5 \ pyaudio \

中失败,错误代码为1

1 个答案:

答案 0 :(得分:0)

如您的错误所示:

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 ++依赖项(detailed instruction here)。

另一种选择是(遵循this answer的建议)对来自Unofficial Windows Binaries for Python Extension Packages的Python软件包使用经过编译的Windows依赖项的非官方库。