我正在看一些创建虚拟助手的教程。现在只是拾起我的声音并写下我的话而已。
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as s:
r.adjust_for_ambient_noise(s)
while True:
audio = r.listen(s)
speech = r.recognize_google(audio, language='pt')
print('Você disse: ', speech)
但是,当我在终端中使用
打开它时$ python /Users/danieldossantos/Desktop/jarvis/chats/main.py
返回,
文件“ /Users/danieldossantos/Desktop/jarvis/chats/main.py”,第13行 语法错误:第13行的/Users/danieldossantos/Desktop/jarvis/chats/main.py文件中的非ASCII字符'\ xc3',但未声明编码;有关详情,请参见http://python.org/dev/peps/pep-0263/