I am trying to install python SpeechRecognition
on my machine.When i am trying to install the package as pip install SpeechRecognition
. I am getting the following error.
import json, urllib.request
ImportError: No module named request
And then i referred and installed requests as pip install requests
i am i am getting Requirement already satisfied
.But still i am unable to install SpeechRecognition
.Please let me know what mistake i am doing.Thanks in advance
This question is related to
python
speech-recognition
from @Zzmilanzz's answer I used
try: #python3
from urllib.request import urlopen
except: #python2
from urllib2 import urlopen
You can do that using Python 2.
request
from urllib2 import urlopen
You cannot have request
in Python 2, you need to have Python 3 or above.
Source: Stackoverflow.com