我正在尝试使Jarvis像程序一样但出现错误
AttributeError:找不到PyAudio;检查安装
import speech_recognition
import pyttsx3
speech_engine = pyttsx3.init('sapi5')
speech_engine.setProperty('rate', 150)
def speak(text):
speech_engine.say(text)
speech_engine.runAndWait()
recognizer = speech_recognition.Recognizer()
def listen():
with speech_recognition.Microphone() as source:
recognizer.adjust_for_ambient_noise(source)
audio = recognizer.listen(source)
try:
return recognizer.recognize_sphinx(audio)
# or: return recognizer.recognize_google(audio)
except speech_recognition.UnknownValueError:
print("Could not understand audio")
except speech_recognition.RequestError as e:
print("Recog Error; {0}".format(e))
return ""
speak("Say something!")
speak("I heard you say " + listen())
我尝试安装pyaudio,但安装错误
pip install pipwin
pipwin install pyaudio
安装错误
_RealGetContents中的文件“ c:\ users \ user \ appdata \ local \ programs \ python \ python38-32 \ lib \ zipfile.py”,行1336 引发BadZipFile(“文件不是zip文件”) zipfile.BadZipFile:文件不是zip文件
答案 0 :(得分:0)
转到this链接并找到PyAudio,然后为您的python版本下载一个。
然后在您的下载文件夹中打开一个Powershell窗口,然后键入:-
pip install PyAu
,然后按 tab ,它将自动完成并按输入。