cathy.sasaki cathy.sasaki - 12 days ago 5
Python Question

What is the safest way to removing Python framework files that are located in different place than Brew installs

I want to remove a Python installed in location that brew complains about, when I run

brew doctor



Warning: Python is installed at /Library/Frameworks/Python.framework


What is the best way?

Here are more details / research:

The message from the brew git website:


Important: If you choose to install a Python which isn't either of
these two (system Python or brewed Python), the Homebrew team can only
provide limited support.


I want to make sure I am not missing anything before I remove the extra python libary.
Specifically, I want to remove the entire Python.framework, those files located here.
/Library/Frameworks/Python.framework/

I have Python 2.7.5 installed natively with Mavericks that I'll use instead - located in the path below. (The difference being -- I believe -- that its put in the root /System folder instead of the root /Library folder.) The good, native location is here:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python


and I already installed python 3.x with
brew install python3
, which put it here:

==> Summary
/usr/local/Cellar/python3/3.4.0 : 5076 files, 85M, built in 112 seconds


Can I just delete these files or are their consequences (beyond having to relink)?
/Library/Frameworks/Python.framework/


Here are steps to remove python from a stackoverflow question in 2010 and a similar question here

Is that approach still sound? Is there anything I should be aware of?

Answer

I'll self-answer. I went through steps and it's straight forward. Pycharms (the IDE I'm use) automatically found the new libraries too. Here are the steps I followed to remove the extra Python libraries on Mavericks that were not native to it and not installed by brew.

Step 1: The native Python 2.7.x version lives here /System/Library/Frameworks/Python.framework/Versions/2.7 (or 2.6, etc), so you can remove any Python that got installed elsewhere.

sudo rm -rf /Library/Frameworks/Python.framework/

Or, according to this article, you should brew install both python 2.7 and python 3.x, and avoid using system python in Mavericks.

Step 2: Remove python in Applications directory (the one where all your apps are).

cd into folder /Applications and ls | grep Python to see what have.

Then remove: sudo rm -rf "Python 3.3"

Step 3:

>>> brew prune

sample output:

Pruned 0 dead formula Pruned 46 symbolic links from /usr/local

Step 4: Run steps recommended by brew doctor

sudo brew link python3

Sample output

Linking /usr/local/Cellar/python3/3.4.0... 19 symlinks created