我安装了语音识别和pyttsx3库
pip install SpeechRecognition
pip install pyttsx3但是,当我试图导入它们时,会出现两个错误
Import "speech_recognition" could not be resolved
Import "pyttsx3" could not be resolved这是我的代码
import speech_recognition as sr
import pyttsx3
audio = sr.Recognizer()发布于 2022-02-12 17:26:41
这通常是由于虚拟env或解释器问题而发生的。可能的解决办法:
的情况下与上面相同
如果您的IDE是VS代码,则打开Microsoft/Pylance.文件并将python服务器设置为服务器,而不是
我面临着类似的问题,无法准确诊断原因,但是流行的CodeRunner扩展和VS代码推荐的python扩展发生了冲突。因此,我禁用了前者和执行的程序,没有任何问题。
https://stackoverflow.com/questions/71094025
复制相似问题