如何获取Python“playsound”模块?

问题描述 投票:0回答:1

我运行了这段代码

import speech_recognition as sr
from playsound import playsound
from gpt4all import GPT4All
import sys
import whisper
import warnings
import time
import os

wake_word = 'victor'
model = GPT4ALL ("/Users/williamsp/Library/Application support/nomic.ai/GPT4ALL/gpt4all-falcon-newbpe-q4_0.gguf")
r = sr.Recognizer()
tiny_model = whisper.load_model('tiny')
base_model = whisper.load_model('base')

并收到此错误

Exception has occurred: ModuleNotFoundError
No module named 'playsound'
  File "/Users/williamsp/Desktop/gpt4all_voice/main.py", line 3, in <module>
    from playsound import playsound
ModuleNotFoundError: No module named 'playsound').

有人可以帮助我了解这里发生了什么,以便我可以修复它。我问了人工智能很多次,但我想我问的不是正确的事情。

我希望这段代码能够作为人工智能语音助手。

python python-3.x artificial-intelligence playsound python-playsound
1个回答
0
投票

您需要安装playsound模块。 在命令行上,尝试运行:

pip install playsound

© www.soinside.com 2019 - 2024. All rights reserved.