Fixing Python install on the Mac after running 'CleanMyMac'

Ned Deily nad at acm.org
Fri May 29 13:28:19 EDT 2015


In article 
<CANc-5Uy3Shm870E7G0tM2S64aX8MC_6jqzdZ0T3=KaRNiTZQCw at mail.gmail.com>,
 Skip Montanaro <skip.montanaro at gmail.com> wrote:

> On Fri, May 29, 2015 at 11:11 AM, Ned Deily <nad at acm.org> wrote:
> 
> > Well, she could just download a current Python 2.7.x for OS X from
> > python.org, install it, and see if that solves the problem.  That would
> > be likely the easiest thing to do and is unlikely to make matters worse.
> >
> 
> Might that appear to work at first, but leave some subtle issues which are
> not at first apparent? I don't know how intertwined Apple's Python instance
> is in the day-to-day operation of the operating system (it certainly seems
> to be on some Linux distros), but it's possible that some Apple-specific
> package isn't available at part of the stock Python 2.7 distribution.

Installing a python.org Python (/usr/local/bin/python*) is independent 
of and does not interfere with use of the Apple-supplied system Pythons 
(/usr/bin/python*).  Apple does ship various third-party Python packages 
("distributions") with its system Python, like numpy, but they tend to 
be old and outdated versions and there are a few Apple-only packages.  
But, should that issue arise, that can be resolved by choosing the right 
path (/usr/local/bin vs /usr/bin) or removing /usr/local/bin from $PATH.

The thing is the original message in this thread had this:
> They are getting:
>      Utility has encountered a fatal error, and will now terminate.  A
>      Python runtime could not be located. You may need to install a
>      framework build of Python or edit the PyRuntimeLocations array in this
>      applications info.plist file.  Then there are two oblong circles. One
>      says Open Console. The other says Terminate.

But ... I just did what I should have done earlier: googled for that 
message.  And I find that the message is coming from a py2app-built 
application (and it seems I answered the question 3 years ago!):

http://stackoverflow.com/questions/10184974/py2app-is-not-copying-the-pyt
hon-framework-to-the-new-app-while-using-virutalenv

The py2app glue code could be looking for Pythons in various spots 
including the system Python.  So, let's make sure the system Python is 
still working.  On the most up-to-date 10.7 Lion system (10.7.5), typing 
the following two commands should give results the same as those shown 
(->):

/usr/bin/python2.7 -c 'import sys;print(sys.version)'
-> 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
-> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]

/usr/bin/python2.7 -c 'import numpy;print(numpy.__file__)'
-> 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/pytho
n/numpy/__init__.py

If not, then it really may be necessary to restore system files which, 
as I noted before, is most safely and accurately done by following 
Apple's directions to restore the system from the recovery partition and 
a good backup of user files.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list