[英]ModuleNotFoundError: No module named 'speech_recognition'
I am using powershell and scoop, windows. 我正在使用Powershell和勺子,窗户。 I already installed speech_recognition bucket but still showing the error.
我已经安装了Speech_recognition存储桶,但仍然显示错误。
Code:
import speech_recognition as sr
import time
import json
import requests
import thread
import subprocess
SPLUNK_URL = "https://localhost"
# Splunk http event collector token
hec_token = ""
The python interpreter shows a ModuleNotFoundError when it can't find the module being imported. 当找不到解释的模块时,python解释器将显示ModuleNotFoundError。 For more information on how
import
works, click here . 有关
import
如何工作的更多信息,请单击此处 。
Since you have installed latest python 3.7, and are working on a code snippet that was built 2 years ago, there is likely a case that the speech_recognition module might not be installed for your current python. 由于您已经安装了最新的python 3.7,并且正在使用2年前构建的代码段,因此可能有可能未为当前python安装Speech_recognition模块。
Before you try anything, execute 在尝试任何事情之前,执行
pip list
and see all the modules currently installed for your current python interpreter. 并查看当前为当前python解释器安装的所有模块。 If the speech_recognition module is not available in the list, then install it:
如果speech_recognition模块在列表中不可用,则安装它:
pip install SpeechRecognition
Also, if you are having multiple python versions installed on your system then make sure you use the pip installer of the python interpreter that you are using for your application. 另外,如果您的系统上安装了多个python版本,请确保使用用于应用程序的python解释器的pip安装程序。 If you are using or like having multiple python versions, then I suggest you use a tool like pyenv .
如果您正在使用或喜欢具有多个python版本,则建议您使用pyenv之类的工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.