Start the correct python program via symbolic link
I recently installed ActivePython 2.7. So I've got a symbolic link in /usr/local/bin/python which points to the 2.7 directory. Trouble is, when I type "python" at the command line, it starts up MacPython 2.6 in /usr/bin/python. I don't understand why the symbolic link is not taking precedence. /usr/local/bin is on my PATH. Any help would be appreciated.
~ $ which python
/usr/bin/python
~ $ find /usr -iname python
/usr/bin/python
/usr/local/bin/python
Path looks like this:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:开发者_开发百科/usr/local/git/bin:/opt/PalmPDK/bin:/opt/PalmSDK/Current/bin:/usr/X11/bin
When you type “python” on the command line, the shell checks the values in your $PATH from left to right, and invokes the program it finds first. Check your current $PATH setting like this:
$ echo $PATH
If it contains both /usr/bin and /usr/local/bin then whichever comes first will take precedence.
in your PATH variable, /usr/bin probabbly is before the /usr/local/bin/ directory. you should use the full path in order to work in this case.
精彩评论