How to Uninstall Python 2.7 on a MAC Os X 10.6.4

How to uninstall Python 2.7 on a Mac OS X 10.6.4?

Do not attempt to remove any Apple-supplied system Python which are in /System/Library and /usr/bin, as this may break your whole operating system.


NOTE: The steps listed below do not affect the Apple-supplied Python 2.7; they only remove a third-party Python framework, like those installed by python.org installers.


The complete list is documented here. Basically, all you need to do is the following:

  1. Remove the third-party Python 2.7 framework

     sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
  2. Remove the Python 2.7 applications directory

     sudo rm -rf "/Applications/Python 2.7"
  3. Remove the symbolic links, in /usr/local/bin, that point to this Python version. See them using

     ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' 

and then run the following command to remove all the links:

    cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm

  1. 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, ~/.zshrc, and/or ~/.zprofile.

How to remove python 2.7 from Mac OS X 10.14.5?

You don't have to remove python 2.7. You can simply add the command as an alias (you can also add this in your ~/.bash_profile file):

alias python='python3.7'

Do not remove python 2.7 (default python package), it may damage your operating system.

If you want you can simply use this command (removes the python installed with homebrew):

brew uninstall python

Refer this question if you really thinking of removing python 2.7. Here is another question which will give you more information.

How to uninstall definitely python 2.7 on MacOS

There's always a system Python 2.7 in macOS (/usr/bin/python), which you can't really remove.

Use python3 if you want to run Python 3.

See PEP 0394 for details about the nomenclature.

Uninstall Python 2.7 from Mac OS X El Capitan

This may be a bit late, but for future searchers I'll post anyway:

I was looking to do the same. But I came across this paragraph at the Foundation (Getting and uninstalling MacPython) which convinced me to leave well alone and not uninstall it.

The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.

Uninstall Python 2 from Mac

Do not remove python 2.7. You can change your preferences to which one to use with certain programs but there are a lot of dependencies on OS that need python 2.7 to run.

Completely uninstall Python 3.10 on Mac

Removing the app does not completely uninstall that version of Python. You will need to remove the framework directories and their symbolic links.

Deleting the frameworks

sudo rm -rf /Library/Frameworks/Python.framework/Versions/[version number]
replacing [version number] with 3.10 in your case.

Removing symbolic links

To list the broken symbolic links.

ls -l /usr/local/bin | grep ‘../Library/Frameworks/Python.framework/Versions/[version number]’

And to remove these links:

cd /usr/local/bin

ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/[version number]' | awk '{print $9}' | tr -d @ | xargs rm*

As always, please be wary of copying these commands. Please make sure the directories in the inputs are actual working directories before you execute anything.

The general idea in the end is to remove the folders and symlinks, and you're good to go.

Here is another response addressing this process: How to uninstall Python 2.7 on a Mac OS X 10.6.4?

Uninstalling Python 2.7 on OSX 10.8.4

Bad idea to uninstall the pre installed version of python. Better idea is to alias python to whatever you want in your bashrc/bash_profile.

In your home directory, aka ~, you might already have a .bash_profile(If you don't have one, you can make it). You can edit that with your favorite text editor and add alias python='python3' Or whatever you want called whenever you type python into bash.

(FWIW Homebrew is the new hotness, you might want to look into it as well)

I uninstalled some Python 2.7 essential files from my Mac, and my OS is now problematic. If I update the software will they be reinstalled?

Hmm, where did you uninstall from? Let's hope you didn't remove it from your System/Library! See this post here - the discussions/answers may provide some help: How to uninstall Python 2.7 on a Mac OS X 10.6.4?. And yes, @FishingCode could be right - an update may just solve the problem.

Steps you could take:

1) Try updating first!

2) If the update did not work AND your accidental deletions did not affect the system files, then try uninstalling any third-party Python files with:

rm -rf </Library/Frameworks/Python.framework/Versions/VERSION_NUMBER> (replace VERSION_NUMBER with the Python version you want to remove)

OR

If you installed with pip, pip uninstall <Python>

You can also remove the third-party Python 2.7 from the same path (check the same post I referenced above! The accepted answer details a good plan to follow!).

Then, reinstall the usual way (https://www.python.org).

3) Check with the Apple stores/Apple technician.

Overall Recommendations:
I do recommend you install a Python version >= 3! Python 2 support has been deprecated since last year and there are some considerable differences between Python 2 and Python 3.x. You can definitely install the latest version (3.8), too. Hope this helps :)



Related Topics



Leave a reply



Submit