First, /usr/local/bin/python is not the Apple-supplied Python; that's always in /usr/bin/python.
Second, /Library/Python/X.Y is not supposed to have anything but site-packages. In particular, that's where you put packages that you want to be shared by all framework builds of PythonX.Y on the system. (There's also /usr/local/lib/pythonX.Y, which also has a site-packages, intended for packages that you want to be shared by all builds, framework and non-framework.)
The actual Apple-supplied Python itself is in /System/Library/Frameworks/Python.framework.
Most third-party framework builds are in /Library/Frameworks/Python.framework. However, Homebrew, MacPorts, and Fink all install to different places. For example, Homebrew will install to `/usr/local/Cellar/python/X.Y.Z/Frameworks/Python.framework.
Non-framework builds instead go into somewhere like /usr/local/share/pythonX.Y—although again, Homebrew, MacPorts, and Fink install to different places.
Finally, many installations will create symlinks (or, sometimes, wrapper scripts) to more typical places. In particular, /usr/local/bin/python is likely a symlink to Versions/X.Y/bin/python inside the appropriate Python.framework as explained above.
If this is all too confusing for you to even comprehend, the simplest thing to do is to uninstall the extra Python2.7 that you installed, and just use Apple's. There are certainly good reasons for some people to have another Python 2.7 around (the blog post linked above shows a number of them), but if you don't have such a reason, why make things harder on yourself?
Since it looks like you're using Homebrew, you can even nondestructively test whether getting it out of the way causes any problems: brew unlink python
will remove all traces of the Homebrew Python from your normal PATH, but leave the actual files behind. Then, if you want it back, just brew link python
; if you're happier without it, brew uninstall python
.
It's worth noting that many common reasons for thinking you need multiple PythonX.Y installations can be solved much more easily, and cleanly, by using virtualenv
.
If you're using MacPorts or Fink, they're explicitly designed to try to stay out of the way of the standard system locations. So, everything will be installed somewhere under your MacPorts/Fink root, which defaults to /opt/local
or /sw
, respectively. (I'll assume /opt/local
.) That means a framework build will go somewhere like /opt/local/Library/Frameworks
, with symlinks into /opt/local/bin
and /opt/local/lib
and the like. The site packages will be in /opt/local/Library/Python/X.Y
and/or /opt/local/lib/pythonX.Y
.
So, there's no possibility of any conflict with any other Python installation… except, of course, that /opt/local/bin
and /usr/local/bin
are probably both on your PATH, it's still possible that pip
means /usr/local/bin/pip
from the Apple or Python.org installation, while ipython
means /opt/local/bin/ipython
from the MacPorts one…