开发者

Start the correct python program via symbolic link

开发者 https://www.devze.com 2023-02-04 18:16 出处:网络
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 Mac

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号