Python: Modules installed with PIP3 on Mac not getting installed?

Summary:
I was essentially just trying to import a module for my python3 installation, but found it was not installed.  Typically, you should be able to install it via PIP (PIP3 in Mac case so it would install to 3.x version instead of built-in 2.x version).  It appears to install fine, but it would not appear in my installed modules when calling help("modules").  Then I noticed the problem...

Details
So in my case, I had python 2.7 and python 3.5 installed via the standard packages provided by python.org.  Nothing wrong with this and very typical, but my tinkering screwed me because I also use brew package installer.  This likely got my pip3 installation messed up and out of sync w/ standard packages installed.  My pip3 pointer was going to a 3.6 version whereas my python3 pointers were going to 3.5.  So, if not obvious, calling pip3 to install modules would only be good for python 3.6.
ls -lh /usr/local/bin

pip3 --version
Now my understanding is that I could simply point my 3.5 version of Python to the PIP 3.6 package directory, but I subscribe the the KISS (Keep It Simple Stupid) method.  Meaning, I'd rather not screw w/ defaults of anything if I don't have to.  So my workaround entails getting rid of the packaged versions and switching over to the brew installed versions.  This way I can use brew to manage the installation updates and all.  

This will hopefully keep my versions in sync so I don't run into further issues.

Workaround:
  1. Place Python Applications in trash.
  2. Delete 3.5 version from your Library (Mac High Sierra uses 2.7 still to this day so pretty safe bet to delete 3.5 if it's there)
    1. rm -rf /Library/Frameworks/Python.framework/Versions/3.5
      • This will remove 3.5 and all it's subfolders if it's found.
  3. Delete pointers for 3.5
    1. rm -rf /usr/local/bin/python3*
      • This should clean up any pointers to old python3 install that no longer exists now.
  4. Install python3 with brew
    1. brew install python3
      • This will install latest version of python and create new python3 pointers in usr/local/bin/ to the brew installed version now.

No comments: