How do I let preinstalled python 2.7 access pip installed modules? I installed python3 using brew, all the modules installed thru pip are located at /usr/local/lib/python3.7/site-packages

How do I let the macOS preinstalled python 2.7 access those modules (b/c I know the module I want to import work for pyhton2.7 too) ?

If I just set PYTHONPATH=/usr/local/lib/python3.7/site-packages, I got this error message:

~ ➤ echo $PYTHONPATH
/usr/local/lib/python3.7/site-packages
~ ➤ python
Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python 2.x!
     PYTHONPATH is currently: "/usr/local/lib/python3.7/site-packages"
     You should `unset PYTHONPATH` to fix this.


I know I can install an individual module by running sudo python -m pip install module xxx (using sudo to install it in /Library/Python/2.7/site-packages)

But is there any easy way to just let pyhton access my python3 modules? If someone has experienced this before and tell me there is none I will also appreciate!
Given the differences in the codebase, not every library will work for both python3 and python2, unless they've gone to the trouble of ensuring compatibility.

You should just be able to run pip install name from the command line to install correctly on the system python.