Judoboy Alex
Judoboy Alex

Reputation: 350

How to change default python from /usr/bin/python to /usr/local/bin/python?

Currently when I enter command which python, I get /usr/bin/python. But I also have python in /usr/local/bin and that's the one I like to use since my pip is located in /usr/local/bin as well. Both python are v2.7.16 and I'm using mac. What's the best way to switch default python from /usr/bin/python to /usr/local/bin/python?

Upvotes: 0

Views: 3713

Answers (1)

hd1
hd1

Reputation: 34667

You don't want to override the system python. You merely want to rearrange your path to place /usr/local/bin ahead of /usr/bin. Honestly, you should be using /usr/bin/python3, as 2.7.16 has been EOL'd. That said, if your heart is set on using python2, install pip and then install virtualenv before creating an environment with 2.7.16 for yourself using virtualenv and using that for all your python needs.

Upvotes: 1

Related Questions