Search code examples
python-3.xpiphomebrewmacbookpro

Python3 in /usr/bin/python3 but pip3 is in /opt/homebrew/bin/pip3 after upgrading MacBook why?


Installing packages using pip3, I can't seem to access them in my python3 interpreter. I then checked that after the MacBook upgrade my python3 is in:

which python3
/usr/bin/python3

and my pip3 is in:

which pip3
/opt/homebrew/bin/pip3

I think pip3 is installing packages in homebrew location and that is why system's native python3 doesn't have access to?

pip3 --version
pip 23.3.1 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)

How do I resolve it?


Solution

  • It seems like you’ve installed Python via homebrew but the system python3 is taking precedence, probably because of the ordering of $PATH.

    If you’d like to always use the Homebrew Python, consider adjusting $PATH. If on the other hand you’d like to always use the system Python, you can use python3 -m pip … to use the pip for to the system Python.