I have python 3.9 installed via Brew on my MacOS 10.14.6 (Mohave) macbook pro. I am having trouble getting pip working. Here I show details of my environment:
-> echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
-> echo $LD_LIBRARY_PATH
-> echo $PYTHONPATH
-> python3 -V
Python 3.9.6
-> python3 -c "import sys;print(sys.path)"
['', '/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/site-packages']
-> python3 -c "import site;print(site.getsitepackages())"
['/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages']
# cannot find pip
-> python3 -m pip
/usr/local/opt/python@3.9/bin/python3.9: No module named pip
# try to install it by hand
-> curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
-> python3 get-pip.py
Collecting pip
Using cached pip-21.1.3-py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Successfully installed pip-21.1.3
# binary gets installed in the correct area
-> ls /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/bin/pip
/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/bin/pip
# module gets installed in the correct packages directory
-> ls /usr/local/Cellar/python\@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip*
/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip:
__init__.py __main__.py __pycache__ _internal _vendor py.typed
/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip-21.1.3.dist-info:
INSTALLER LICENSE.txt METADATA RECORD REQUESTED WHEEL entry_points.txt top_level.txt
# but still no module found
-> python3 -m pip
/usr/local/opt/python@3.9/bin/python3.9: No module named pip
# this is a symlink to the same area listed above in the sys.path output:
-> ll /usr/local/opt/python@3.9/bin/python3.9
/usr/local/opt/python@3.9/bin/python3.9 -> ../Frameworks/Python.framework/Versions/3.9/bin/python3.9
It seems python is not actually searching it's site-packages folder listed in sys.path for modules. Any suggestions?