title: Python Speech Recognition: 'module' object has no attribute 'microphone'
body: <p>Running the following code on a macbook air 64 bit, testing the code on python 2.7 and python 3.4</p>
  
  <pre><code>import speech_recognition as sr
  r = sr.Recognizer()
  with sr.microphone() as source:
      audio = r.listen(source)
  
  try:
      print("You said " + r.recognize(audio))
  except LookupError:
      print("Could not understand audio")
  </code></pre>
  
  <p>When i try python 2.7, I keep getting the error of :</p>
  
  <pre><code>Traceback (most recent call last):
  File "star.py", line 3, in &lt;module&gt;
  with sr.microphone() as source:
  AttributeError: 'module' object has no attribute 'microphone'
  </code></pre>
  
  <p>(star.py is the name of the file I am testing it on)
  When I try python 3.4, I keep getting the error of :</p>
  
  <pre><code>Traceback (most recent call last):
  File "star.py", line 1, in &lt;module&gt;
  import speech_recognition as sr
  ImportError: No module named 'speech_recognition'
  </code></pre>
  
  <p>I have downloaded the speech_recognition and pyaudio libraries yet the cause of the error still eludes me. Please Help!</p>