I'm trying to cleanup my system python environment. I've previously installed another python2 instead of the system provided one using Homebrew and I've uninstalled this one.
I thought there should be only one python2 now on my mac. However, which python
gives /usr/bin/python
and I noticed there is another one in /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
.
Under /usr/bin/
the output of ls -l
is
lrwxr-xr-x 1 root wheel 74 Jul 22 2015 pydoc2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pydoc2.6
lrwxr-xr-x 1 root wheel 74 Jul 22 2015 pydoc2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
-rwxr-xr-x 2 root wheel 58416 Jul 15 2015 python
-rwxr-xr-x 5 root wheel 925 Sep 10 2014 python-config
lrwxr-xr-x 1 root wheel 18 Apr 8 2016 python2 -> /usr/bin/python2.7
lrwxr-xr-x 1 root wheel 75 Jul 22 2015 python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x 1 root wheel 82 Jul 22 2015 python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x 1 root wheel 75 Jul 22 2015 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 Jul 22 2015 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 2 root wheel 58416 Jul 15 2015 pythonw
lrwxr-xr-x 1 root wheel 76 Jul 22 2015 pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x 1 root wheel 76 Jul 22 2015 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
So I think it means /usr/bin/python
is not a symlink and it is itself a binary. Meanwhile /usr/bin/python2.7
is a symlink of /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
.
Under /System/Library/Frameworks/Python.framework/Versions/2.7/bin/
lrwxr-xr-x 1 root wheel 7 Jul 22 2015 2to3 -> 2to32.7
lrwxr-xr-x 1 root wheel 8 Jul 22 2015 2to3-2 -> 2to3-2.7
-rwxr-xr-x 1 root wheel 288 Sep 10 2014 2to3-2.7
lrwxr-xr-x 1 root wheel 6 Jul 22 2015 2to32.7 -> 2to3-2
lrwxr-xr-x 1 root wheel 5 Jul 22 2015 idle -> idle2
lrwxr-xr-x 1 root wheel 7 Jul 22 2015 idle2 -> idle2.7
-rwxr-xr-x 1 root wheel 230 Sep 10 2014 idle2.7
lrwxr-xr-x 1 root wheel 6 Jul 22 2015 pydoc -> pydoc2
lrwxr-xr-x 1 root wheel 8 Jul 22 2015 pydoc2 -> pydoc2.7
-rwxr-xr-x 1 root wheel 215 Sep 10 2014 pydoc2.7
lrwxr-xr-x 1 root wheel 7 Jul 22 2015 python -> python2
lrwxr-xr-x 1 root wheel 14 Jul 22 2015 python-config -> python2-config
lrwxr-xr-x 1 root wheel 9 Jul 22 2015 python2 -> python2.7
lrwxr-xr-x 1 root wheel 16 Jul 22 2015 python2-config -> python2.7-config
-rwxr-xr-x 1 root wheel 34944 Jul 15 2015 python2.7
-rwxr-xr-x 1 root wheel 1818 Jul 15 2015 python2.7-config
lrwxr-xr-x 1 root wheel 8 Jul 22 2015 pythonw -> pythonw2
lrwxr-xr-x 1 root wheel 10 Jul 22 2015 pythonw2 -> pythonw2.7
-rwxr-xr-x 1 root wheel 34944 Jul 15 2015 pythonw2.7
lrwxr-xr-x 1 root wheel 9 Jul 22 2015 smtpd.py -> smtpd2.py
-rwxr-xr-x 1 root wheel 18681 Sep 10 2014 smtpd2.7.py
lrwxr-xr-x 1 root wheel 11 Jul 22 2015 smtpd2.py -> smtpd2.7.py
However, it seems /usr/bin/python
and /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
are same binary since they both gives
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
when I ran them.
I'm confused whether these two binary indicate same python interpreter? But why are they two standalone binary files?