ImportError: No module named request
Solution 1:
The SpeechRecognition
library requires Python 3.3 or up:
Requirements
[...]
The first software requirement is Python 3.3 or better. This is required to use the library.
and from the Trove classifiers:
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
The urllib.request
module is part of the Python 3 standard library; in Python 2 you'd use urllib2
here.
Solution 2:
You can do that using Python 2.
- Remove
request
- Make that line:
from urllib2 import urlopen
You cannot have request
in Python 2, you need to have Python 3 or above.
Solution 3:
from @Zzmilanzz's answer I used
try: #python3
from urllib.request import urlopen
except: #python2
from urllib2 import urlopen