4

I've been having issues with Python recently, such as compatibility with anaconda. When I ran Homebrew's brew doctor, I think I came across the problem, as laid out below. How can I wipe these files and do a clean install of Python?

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
    /opt/local/bin/curl-config
    /opt/local/bin/freetype-config
    /opt/local/bin/libpng-config
    /opt/local/bin/libpng16-config
    /opt/local/bin/nc-config
    /opt/local/bin/ncurses5-config
    /opt/local/bin/ncursesw5-config
    /opt/local/bin/pcre-config
    /opt/local/bin/python2.7-config
    /opt/local/bin/xml2-config
    /Users/adamg/anaconda/bin/freetype-config
    /Users/adamg/anaconda/bin/libdynd-config
    /Users/adamg/anaconda/bin/libpng-config
    /Users/adamg/anaconda/bin/libpng15-config
    /Users/adamg/anaconda/bin/llvm-config
    /Users/adamg/anaconda/bin/nc-config
    /Users/adamg/anaconda/bin/python-config
    /Users/adamg/anaconda/bin/python2-config
    /Users/adamg/anaconda/bin/python2.7-config
    /Users/adamg/anaconda/bin/xml2-config
    /Users/adamg/anaconda/bin/xslt-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config

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

Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.
Adam_G
  • 7,337
  • 20
  • 86
  • 148

2 Answers2

2

To uninstall using brew use this command brew uninstall <package>.

Mac OS X has python preinstalled so there is no need to install another Python instance unless it's necessary.

You can run brew install python to install Python using Homebrew.

Even though python is preinstalled as @jgritty hinted in comments, you may consider not to rely on it for development purposes.

So you should brew uninstall python then brew install python.

In order to remove an installed Python (2.7) instance, you need to run the following commands in your terminal;

  1. sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7

  2. sudo rm -rf "/Applications/Python 2.7"

  3. remove the symbolic links in /usr/local/bin that point to this python version see ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7'

  4. if necessary, edit your shell profile file(s) to remove adding /Library/Frameworks/Python.framework/Versions/2.7 to your PATH environment file. Depending on which shell you use, any of the following files may have been modified: ~/bash_login, ~/bash_profile, ~/cshrc, ~/profile, ~/tcshrc, and/or ~/zprofile.

A reference by @Ned Deily available at this link.

nyedidikeke
  • 6,899
  • 7
  • 44
  • 59
iProgram
  • 6,057
  • 9
  • 39
  • 80
  • Will `brew uninstall` uninstall the preinstalled version? – Adam_G Feb 20 '15 at 00:06
  • I think it should. If you installed it with `brew` then `brew` should uninstall it. If not tell me and I will do research on it. – iProgram Feb 20 '15 at 09:49
  • But it's the pre-installed version. Not a version installed with brew. What's the best way to remove it? – Adam_G Feb 20 '15 at 19:50
  • I see. I got confused. Will do research when I have time then edit my answer. – iProgram Feb 20 '15 at 19:58
  • 2
    OS X does not install a python to /Library. The python.org dmg installer does. This is therefore safe but I beg you, with all of my heart, to never try to remove something that the OS has installed. In particular, do not remove /usr/bin/python. – Tim Smith Feb 21 '15 at 20:43
  • Additionally, Homebrew will never uninstall anything that it did not install. – Tim Smith Feb 21 '15 at 20:44
  • @TimSmith So do you mean that this wouldn't work with the preinstalled one then and only the downloaded? – iProgram Feb 21 '15 at 22:29
  • 2
    Yes, these instructions will remove a user-installed Python and will not remove the Python that shipped with OS X. – Tim Smith Feb 21 '15 at 23:48
  • 1
    You should not ever uninstall the system-supplied Python version as other OS components rely on it. Luckily the instructions here are not going to achieve that, as the system Python lives in a different location. – Martijn Pieters Feb 22 '19 at 11:18
2

You can do brew list to see what brew has installed.

If python and python3 are not in that list, you may want to install either or both.

Based on these files:

/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config

I would guess you ran a python 3.4 install downloaded directly from python.org or somewhere else.

jgritty
  • 11,660
  • 3
  • 38
  • 60
  • Thanks. I see that brew didn't install any Python. Is it best to remove the instances of Python that I downloaded directly, and then install from brew? One of my issues is with getting python to play nice with libraries like anaconda – Adam_G Feb 20 '15 at 00:04
  • I'd say it's best to remove the directly downloaded version and then use brew to install. Brew installed python will not interfere with your system python. – jgritty Feb 20 '15 at 19:20
  • Thanks. What's the best way to remove it? – Adam_G Feb 20 '15 at 19:50