'这是我的代码:'
import speech_recognition as sr
# get audio from the microphone
r = sr.Recognizer()
with sr.Microphone() as source:
print("Please say response:")
r.adjust_for_ambient_noise(source)
audio = r.listen(source)
resp=r.recognize_google(audio)
try:
print("You said " + resp)
except sr.UnknownValueError:
print("Could not understand audio")
except sr.RequestError as e:
print("Could not request results; {0}".format(e))
'这是错误消息:'
runfile('C:/Users/Owner/speechrecognification.py',wdir='C:/Users/Owner'(追踪(最近一次通话(:
文件"&";,第1行,在runfile('C:/Users/Owner/speechrecisition.py',wdir='C:/Users/Owner'(
文件";C: \Users\Owner\anaconda3\envs\py27\lib\site-packages\spyder_kernels\customize\spydepustimize.py",第827行,在运行文件中execfile(文件名,命名空间(
文件";C: \Users\Owner\anaconda3\envs\py27\lib\site-packages\spyder_kernels\customize\spydepustimize.py",第95行,在execfile中exec(compile(scripttext,filename,'exec'(,glob,loc(
文件";C:/Users/Owner/speechrecognification.py";,第11行,in以sr.Microphone((为来源:
文件";C: \Users\Owner\anaconda3\envs\py27\lib\site-packages\speech_recognition_init_.py",第141行,在中输入input=True,#stream是输入流
文件";C: \Users\Owner\anaconda3\envs\py27\lib\site-packages\pyaudio.py",线路750,打开stream=流(self,*args,**kwargs(
文件";C: \Users\Owner\anaconda3\envs\py27\lib\site-packages\pyaudio.py",第441行,在initself中_stream=pa.open(**参数(
IOError:[Erno-9999]未预料到的主机错误
我自己在使用pyaudio时遇到了很多问题,为我修复的是将其粘贴到中
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(ssl, '_create_unverified_context', None)):