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.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityThe 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.
/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.