I cannot figure out how to get the correct version of pip3 on my Mac as the default. I installed and use Python3 via brew:
❯ which python3
/usr/local/bin/python3
❯ ls -l /usr/local/bin/python3
<ELIDED> /usr/local/bin/python3 -> ../Cellar/[email protected]/3.9.10/bin/python3
but pip3 defaults to what looks like the Mac default Python:
❯ pip3 --version
pip 20.2.3 from /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
How would I go about fixing this?
CodePudding user response:
On linux you have the update-alternatives
command, I don't know if you have it on OSX.
Otherwise You can create a symbolic link.
Or use python -m pip
CodePudding user response:
Related to Make python3 as my default python on Mac.
It is necessary to add the path to the additional tools. e.g., in ~/.zshrc
add:
export PYTHON_HOME=$(brew --prefix)/opt/python/libexec
export PATH=$PYTHON_HOME/bin:$PATH
However, the following will not work:
export PYTHON_HOME=$(brew --prefix)/opt/python/libexec/bin
export PATH=$PYTHON_HOME:$PATH
For some reason, part of the path will get cannibalized.
CodePudding user response:
Try running these at startup in terminal before you run python:
alias python=/usr/local/bin/python3
alias pip=/usr/local/bin/pip3