27

I installed Python 3 to learn Python and quickly realized that django isn't compatible with Python 3.

How do I uninstall Python 3 on my Mac so that I can install a different version?

3
  • See this answer and substitute 3.2 for 2.7.
    – Ned Deily
    Apr 28, 2011 at 23:49
  • If you are using ActivePython, type sudo pythonselect 2.7 to switch between Python versions. May 1, 2011 at 20:20
  • 1
    You can have several versions of python on your machine without conflicting
    – mmmmmm
    Jan 25, 2014 at 12:10

4 Answers 4

7

Python.org has added uninstall directions to the documentation:

http://docs.python.org/3/using/mac.html

Reading this and then inspecting my install, my list of things to uninstall is:

  • MacPython 3.3 folder in your Applications folder.
  • /Library/Frameworks/Python.framework
  • about 20 symlinks in /usr/local/bin.
  • reference in shell path (if exists)

Using Text Wranger, which can show invisible files, I browsed my home folder and I didn't see a .bash_profile, just .bash_history. So the installer only adds the reference if the Bash profile exists. (echo $path) didn't show either. (see also: https://stackoverflow.com/questions/7501678/set-environment-variables-on-mac-os-x-lion)

The installer package really should include an uninstall script.

As of April 2013 most tutorials and courses still require Python 2, so many people will need to uninstall Python 3.

1
0

How did you install it? If you used an installer, then follow yoda's wise advice. Open a terminal and remove the directory /System/Library/Frameworks/Python.framework/Versions/3.0 if it exists. You should also make sure that the symlink /System/Library/Frameworks/Python.version/Versions/Current does not point to 3.0. If it does, then reset it to point to 2.6 or something appropriate.

2
  • 5
    In general, you should never remove anything in /System/Library! The files installed there are controlled by Apple as part of OS X. You could seriously damage your system by deleting the wrong file. Fortunately, there is no such file to delete since Python 3 has not yet been shipped by Apple in an OS X release. User installs of Python 3 are installed elsewhere. For example, the python.org installers install to /Library/Frameworks.
    – Ned Deily
    Apr 28, 2011 at 23:46
  • 3
    ...except a ton of drivers and applications that interact with the underlying system (i.e. window resizers or UI addons/themes) put files in /system/library, using a superuser password provided at install time, but have normal user-privileged uninstallers. As a result, a heavily-used modern Mac (especially one that has been through a few OS upgrades) is going to have a /system/library dir that is totally littered with junk. Is removing stuff in that dir dangerous? Sure. That doesn't mean there aren't common, good reasons to manipulate files in the directory. Just be aware.
    – Zac B
    Sep 19, 2012 at 17:18
0

If the python3 location is in /usr/bin/python3 then you won't be able to delete it directly, the MAc OS may throw error like “Operation not permitted” or “read only file system” etc, because Mac OS mount the system files as read only partition and use a mechanism called system integrity protection(csrutil).

To remove the file you need to do the the following steps,

  1. Reboot the Mac OS into recovery mode
  2. Open disk utility
  3. Unmount “Macintosh HD” and mount again
  4. Open terminal from utilities Run command “csrutil disable”
  5. Remove the file from “ rm /volumes/macintosh\ hd/usr/bin/python3 “
  6. Run command “csrutil enable”
  7. Reboot the OS again
-4

This is not a programming question. You uninstall it just as you uninstall any other software on a mac! You have a couple of options

  1. Goto Finder>Applications>Python 3.0 (or whatever the folder is named). Right click, select Move to Trash, empty trash.
  2. Open Terminal, type sudo rm -rf /Applications/Python\ 3.0/, enter password and you're done.

Different versions of python go in different folders. So, you can install a new version and leave v3.0 as it is. Just remember to add the new python dir to your path and remove the old one or set an alias for python to python2.x

Next time, remember that such questions are better asked on https://apple.stackexchange.com/

4
  • Thanks a lot! I will remember to use apple.stackexchange.com for mac question.
    – Solomon85
    Apr 28, 2011 at 23:21
  • 4
    Actually, that does not remove a framework install of Python. It only removes a few auxiliary files.
    – Ned Deily
    Apr 28, 2011 at 23:43
  • Why on earth is Google promoting this as the answer to this question? Jul 13, 2020 at 16:48
  • 3
    This answer is wrong and a great example of why questions about specialized programming tools should be asked on programming sites and not on sites intended for mere end-users ;-)
    – Alex R
    Oct 28, 2020 at 16:00

You must log in to answer this question.