1

Why isn't export python=/usr/local/bin/python2.7 changing the path to python?

I am baffled by the following:

$ which python
/usr/bin/python
$ export python=/usr/local/bin/python2.7
$ which python
/usr/bin/python

I'm using OSX v10.12.

6

The program which determines the path of shell commands.

What you did in the second statement is set a variable named python.

Shell commands and variables are entirely different things.

What you'd might like to use is an alias.

alias python="/usr/local/bin/python2.7"

Note, that (except in zsh or tcsh, or if your which is itself a shell function that invokes GNU which, as recommended by its manual), which will not show the alias, while e.g. type python will.

1
  • Additionally, /usr/bin/python is probably a symbolic link to the system's version of python. Alternatively they could change the link to point to the version of python they wish to use. After verifying it really is a link and backing it up just in case of course. – Thegs Sep 5 '17 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.