python - Python 语音识别在 Manjaro Linux 中不起作用
问题描述
我正在做这个简单的项目来创建你自己的助手,第一步是语音识别。我尝试运行它,但它似乎不起作用。这是代码:
import speech_recognition as fri
listen = fri.Recognizer()
try:
with fri.Microphone() as cmd:
print('Waiting...')
voice = listen.listen(cmd)
cmdz = listen.recognize_google(voice)
print(cmdz)
except:
pass
这是我执行代码时遇到的错误
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib pcm_oss.c:397:(_snd_pcm_oss_open) Cannot open device /dev/dsp
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
Waiting...
我应该怎么办 ?
解决方案
推荐阅读
- c++ - system() 之后的脚本仅在应用程序预先打开时才有效
- javascript - 我的 Node.js 服务器不断收到错误消息:“__dirname is not defined”
- android - Android wifi p2p 视频聊天应用
- python - Django send_mail 使用 RequestFactory 给出 NoneType 错误,但在视图之外运行代码时没有(包括测试代码)
- mongodb - 在 MongoDB 中创建应用程序用户的约定是什么?
- c - 使用 process_vm_readv 读取任意数量的内存
- php - 从 PHPMyAdmin 但不是从 TextArea 提交 MySQL 查询
- ruby-on-rails - Rails 5:从另一个控制器访问创建方法
- android - 字段“签名”的值不正确:值为 662655099,但应为 67324752
- glib - 如何使用 vala/glib 通过管道传输到进程