title: ImportError: No module named _bsddb
body: <p>I had some problems with upgrading matplotlib recently so I ended up installing different versions of Python on my Mac (Sierra) via brew, and then uninstalled afterwards. However, now matplotlib works (2.0.2) but whenever I run a particular python script that used to work I get an error which I didn't have before:</p>
  
  <pre><code>Traceback (most recent call last):
    File "sim.py", line 254, in &lt;module&gt;
      main()
    File "sim.py", line 118, in main
      db = shelve.open('.sim_balance', 'c')
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 243, in open
      return DbfilenameShelf(filename, flag, protocol, writeback)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 227, in __init__
      Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 84, in open
      mod = __import__(result)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/dbhash.py", line 7, in &lt;module&gt;
      import bsddb
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bsddb/__init__.py", line 67, in &lt;module&gt;
      import _bsddb
  ImportError: No module named _bsddb
  </code></pre>
  
  <p>According to my searches online this has something to do with my brew installed python interfering? I also deleted all my files in <code>/Library/Python/2.7/site-packages</code> yesterday which may have caused this as well. </p>
  
  <p>I have tried homebrew <code>brew install berkeley-db</code> but then <code>pip install bsddb3</code> yields:</p>
  
  <pre><code>Terrys-MBP:site-packages Terry$ pip install bsddb3
  Collecting bsddb3
    Using cached bsddb3-6.2.4.tar.gz
      Complete output from command python setup.py egg_info:
      Can't find a local Berkeley DB installation.
      (suggestion: try the --berkeley-db=/path/to/bsddb option)
  
      ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/m5/1fg5rnj11_9cz5pntlqlwzyc0000gn/T/pip-build-elBAFK/bsddb3/
  </code></pre>
  
  <p>EDIT: Solved. Installed anaconda, installed bsddb via <code>conda install</code> and everything is working now.</p>