Jaime Perez Jaime Perez - 1 month ago 12
Python Question

How to direct directory from file to another on Mac

So I am currently trying to install python3 into my Mac and whenever I type in

which python3


It gives me the response of

/usr/local/bin/python3


However, I want it to point to this directory below:

/usr/local/Cellar/python3/3.5.2_2/bin/python3


How do I make this happen? Please Help!!

Answer

When you install python with brew, it will actually create a symlink from /usr/loca/bin/... to /usr/loca/Cellar/.... You can check this for example by running this command:

$ ls -l /usr/local/bin/python3
lrwxr-xr-x  1 mfischer  admin  35  3 Aug 07:34 /usr/local/bin/python3 -> ../Cellar/python3/3.5.1/bin/python3

If this is not the case, simply recreate the link.

rm /usr/local/bin/python3
ln -s /usr/local/Cellar/python3/3.5.2_2/bin/python3 /usr/local/bin/python3