Note that there are some explanatory texts on larger screens.

plurals
  1. POpath cache of bash command
    primarykey
    data
    text
    <p>The python script can't been found after uninstalled the old version with ports:</p> <pre><code> sudo port uninstall --follow-dependents python27 </code></pre> <p>But the python2.7 file is in the system path:</p> <pre><code>➜ ~ $ which python2.7 /usr/bin/python2.7 ➜ ~ $ python2.7 -V -bash: /opt/local/bin/python2.7: No such file or directory ➜ ~ $ ll /opt/local/bin/python* ls: /opt/local/bin/python*: No such file or directory ➜ ~ $ ll /usr/bin/python* -rwxr-xr-x 2 root wheel 57K 10 12 21:47 /usr/bin/python -rwxr-xr-x 5 root wheel 925B 10 12 21:47 /usr/bin/python-config lrwxr-xr-x 1 root wheel 75B 10 12 21:47 /usr/bin/python2.5 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 lrwxr-xr-x 1 root wheel 82B 10 12 21:47 /usr/bin/python2.5-config -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config lrwxr-xr-x 1 root wheel 75B 10 12 21:47 /usr/bin/python2.6 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 lrwxr-xr-x 1 root wheel 82B 10 12 21:47 /usr/bin/python2.6-config -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config lrwxr-xr-x 1 root wheel 70B 10 13 20:38 /usr/bin/python2.7 -&gt; /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 lrwxr-xr-x 1 root wheel 82B 10 12 21:47 /usr/bin/python2.7-config -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config -rwxr-xr-x 2 root wheel 57K 10 12 21:47 /usr/bin/pythonw lrwxr-xr-x 1 root wheel 76B 10 12 21:47 /usr/bin/pythonw2.5 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5 lrwxr-xr-x 1 root wheel 76B 10 12 21:47 /usr/bin/pythonw2.6 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6 lrwxr-xr-x 1 root wheel 76B 10 12 21:47 /usr/bin/pythonw2.7 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7 ➜ ~ $ /usr/bin/python2.7 -V Python 2.7.5 ➜ ~ $ ll /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 -rwxr-xr-x 1 root wheel 34K 10 12 21:47 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 </code></pre> <p>The PATH value is:</p> <pre><code>➜ ~ $ echo $PATH|tr ':' '\n' /Users/adyliu/.rvm/gems/ruby-2.0.0-p247/bin /Users/adyliu/.rvm/gems/ruby-2.0.0-p247@global/bin /Users/adyliu/.rvm/rubies/ruby-2.0.0-p247/bin /Users/adyliu/.rvm/bin /opt/local/bin /opt/local/sbin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /Users/adyliu/bin </code></pre> <p>I installed python2.7.3 using ports before, so the path of '/opt/local/bin' is before the path of '/usr/bin', and the python script(python2.7) was in '/opt/local/bin' before I uninstalled this python.</p> <p>Now my question is why the python script can not been found though the file is in the system path.</p> <pre><code>➜ ~ $ for d in `echo $PATH|tr ':' ' '`;do if [ -x $d/python2.7 ]; then ls -lh $d/python2.7;fi;done lrwxr-xr-x 1 root wheel 70B 10 13 20:38 /usr/bin/python2.7 -&gt; /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 ➜ ~ $ which python2.7 /usr/bin/python2.7 ➜ ~ $ python2.7 -V -bash: /opt/local/bin/python2.7: No such file or directory </code></pre> <p>How to remove the hash cache of a command:</p> <pre><code>➜ ~ $ command -V python2.7 python2.7 is hashed (/opt/local/bin/python2.7) ➜ ~ $ type python2.7 python2.7 is hashed (/usr/bin/python2.7) ➜ ~ $ type python python is hashed (/usr/bin/python) </code></pre> <hr> <p><strong>Update 1</strong>:</p> <p>I DO NOT know why the 'python2.7' can been found currectly NOW (10 minites after the question was posted).</p> <pre><code>➜ ~ $ command -V python2.7 python2.7 is hashed (/usr/bin/python2.7) </code></pre> <hr> <p><strong>Update 2</strong>:</p> <p>The 'python2' script still can not been found:</p> <pre><code>➜ ~ $ python2 -V -bash: /opt/local/bin/python2: No such file or directory ➜ ~ $ python2 -bash: /opt/local/bin/python2: No such file or directory ➜ ~ $ which python2 /usr/bin/python2 ➜ ~ $ command -V python2 python2 is hashed (/opt/local/bin/python2) ➜ ~ $ python2 -V -bash: /opt/local/bin/python2: No such file or directory ➜ ~ $ /usr/bin/python2 -V Python 2.7.5 ➜ ~ $ ll /usr/bin/python2 lrwxr-xr-x 1 root wheel 18B 10 13 20:50 /usr/bin/python2 -&gt; /usr/bin/python2.7 ➜ ~ $ python2.7 -V Python 2.7.5 ➜ ~ $ python2 -V -bash: /opt/local/bin/python2: No such file or directory </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload