0

I've recently decided I'd like to switch from my downloaded versions (as in downloaded from python.org) of python 2 and 3 to Homebrew installs. I've installed both python 2 and 3 from Homebrew using a simple brew install python(3), but when I open a python shell session in my terminal it's still the old versions of python.

I was of course expecting this, but how would I go about making it so the Homebrew versions of python are used over my previously installed ones? Or, better yet, what I would ideally like to do is just completely uninstall the old versions of python and use the new ones. Is that possible?

From my research it seems simply uninstalling versions of python is overly difficult on Mac. I would normally mess around with this and try to solve it myself, but I've heard of some bad things happening if you play around with the wrong versions of python on Mac.

I'm using OS X El Captian Version 10.11.

EDIT: I should also mention I'm not looking for any tricks that will make it only work in the terminal. Also, in PyCharm, the newly installed versions of python don't even appear when I try to change python interpreter versions.

0

The problem was my user-specific ~/.bash_profile file had auto-generated lines in it that look like the following:

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

To solve the problem, I simply commented out all of the lines so that they wouldn't overwrite other paths that were linking the version of python I wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.