Broken python after Mac OS X update
Question: After an update of OS X Yosemite 10.10.5 my Python install has blown up. I am
not using brew, macports, conda or EPD, here, but a native Python build. While
it was perfectly functional before, now it seems to have lost track of the
installed packages. I try to start an ipython session and it returns

    
    
    $ ipython
    Traceback (most recent call last):
       File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython", line 7, in <module>
    from IPython import start_ipython
    ImportError: No module named IPython
    

Then I resort to checking whether I can re-install ipython but my pip also
went missing:

    
    
    $ sudo pip install ipython
    Traceback (most recent call last):
       File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 7, in <module>
    from pip import main
    ImportError: No module named pip
    

So may it be that pip disappeared?

    
    
    $ sudo easy_install install pip
    Traceback (most recent call last):
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
    ImportError: No module named pkg_resources
    

I have tried solutions to this [last
problem](http://stackoverflow.com/questions/7446187/no-module-named-pkg-
resources) reported before but they do not seem to work.

So it seems that Python has lost track of itself. Anyone, clues of what may
have gone wrong and how can I fix this? Thanks!


Answer: It is not quite clear what you mean by saying that you installed "a native
Python build". But in any case, it seems you wrote files of your installation
into the system directory" `/System/...`, which is not a good thing to do,
since these are controlled by OSX and e.g. may be overwritten by a system
update.

Apparently, that is then what happened. You updated OSX, it clobbered your
changes to `/System/...` and thereby messed up your Python installation.

Note that AFAIK, with OSX 10.11 it will no longer even be possible to write
into system directories, so you will need a different setup anyway.

A suggestion to avoid/fix this is simple: Use one of the standard ways to
install your Python stack -- my personal recommendation is either macports or
anaconda.

