0

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?

3 Answers 3

0

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

0

Try running these at startup in terminal before you run python:

alias python=/usr/local/bin/python3
alias pip=/usr/local/bin/pip3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.