Python is one of the most popular and preferred languages among software developers, web developers, and data science professionals. To create Python solutions, one needs to install Python on their system. The most interesting thing about Python is that you can use more than one version of it on the same computer system.
In accordance with the title of this article, it is bound to get one question in your mind: Why uninstall Python? The primary reason to remove Python from the system is to install its new version.
The Python software consists of various bugs that need to be fixed timely. Also, there are many other libraries and packages that become outdated. Every version of Python comes with fixes to bugs and security issues. So, to make sure that your system is not affected by bugs or security issues, it becomes necessary to uninstall Python of the older version and install the new and the most recent version.
Note: The best way to install the new version of Python is to delete Python with the older version. It, sometimes, may result in the breaking of Python on the system if you install the new version before uninstalling the older one.
The next question you might get is: How to uninstall Python from your system?
There is no standard way to uninstall Python on operating systems. You will need to follow uninstallation steps specific to the operating system on your computer.
Note: If you want to remove Python packages from your computer, you do not need to uninstall Python from your computer. You can add, remove, and search for specific Python packages using the pip tool. If you don’t know how to use pip, our detailed guide will teach you what you need to know in a matter of minutes.
Well, let us start with a step-by-step guide on how to uninstall Python from Windows, macOS, and Linux platforms.
Contents
How To Uninstall Python From Windows?
Windows makes it easy to uninstall Python. You can remove any version of Python installed on your computer in three simple steps.
Uninstall Python in Windows Using Control Panel
- Press the Windows key on your keyboard or press the Windows button on the bottom-left of your screen to open the Start menu.
- Type in “Control Panel” and find and launch the Control Panel from the list of options.
After the Control Panel opens up, you must click on the “Uninstall a program” button under the “Programs” section on the bottom left. A menu with all of the programs installed on the computer will open up.
Step #3: Uninstall Python
You must scroll down the list of programs and find the version(s) of Python installed on your computer. Next, select the program by left-clicking on it and clicking the “Uninstall” button.
The uninstallation wizard will launch, and after you confirm your decision to uninstall Python, it will be removed from your computer.
To remove Python from your computer completely, you will need to remove Python from Path.
Step #4: Remove Python from Path
The Python uninstaller automatically removes Python from Path when it runs. That said, it is best to check whether Python has been removed from Path. It’s easy to do and doesn’t take long:
- Press the Windows key and enter “environment variables.” Launch the settings menu in the Control Panel. Windows Search Environment Variables. A “System Properties” menu will appear. Find and click the “Environment Variables” button.Windows System Properties Menu
- Highlight the “Path” variable in the system variable section by left-clicking it. Then press the “Edit” button.Windows Environment Variables Menu.
- If you see a path of the Python bin folder in the menu, remove it by selecting it and pressing the “Delete” button on the right side of the menu.Windows Edit Environment Variable. And with that, you will have removed Python entirely from your Windows computer.
Uninstall Python Windows Command Line
You can also remove Python from Windows using the command line (command prompt (CMD)). Let us see how to do it in steps.
- On your Windows system, open the command prompt (CMD).
- Now, use the cd keyword to enter the appropriate path of the Python files to access them, as shown below:
cd C:\Users\Name\Library\FileName\Python
- Now, after accessing the Python file, delete it using the del keyword.
How To Uninstall Python From Mac?
Uninstalling Python on a computer running macOS is not always a good idea. This is because macOS comes with Python pre-installed, and the operating system depends on Python for its inner workings.
The pre-installed Python framework appears in /System/Library/Frameworks/Python.framework. Several symlinks can be found in usr/bin/python. Removing this version of Python will break macOS and may cause the OS to malfunction.
That said, if you’ve installed a third-party Python framework on your Mac, you can uninstall it safely. Here’s how you do it:
Uninstall Python – Mac
Step #1: Remove Python from Applications
Open up Finder, and navigate to the Applications folder. Here, you will find folders of the Python version(s) you have installed. You must move them to the Trash. If you only want to remove a specific version of Python from your Mac, make sure you only move the relevant Python folder into the Trash.
If a dialog box appears asking you to enter the password to your computer, enter the password and click “OK.”
The folders will have moved to the Trash. Next, you must navigate to the Trash, highlight the Python version(s), and right-click. From the options that appear, select the “Delete Immediately” option.
Deleting the folder will not remove Python from the computer completely. You must remove it from the Library directory and also remove the symbolic links.
Step #2: Remove Python from /Library
You will need to use the Terminal to remove Python from the Library directory. To open Terminal, press Cmd ⌘ + Space and search for it, then launch it.
To remove the third-party frameworks from the directory, enter the following command into Terminal:
sudo rm -rf /Library/Frameworks/Python.framework
You may be asked to enter your system password.
Enter it if prompted. If you want to remove only a specific version of Python from your computer, specify the version by modifying the command like so:
sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.8
Step #3: Remove Symbolic Links
Steps #1 and #2 will have removed Python directories and files from your Mac. However, links that reference Python folders that have been deleted may remain on your computer. These links are called symbolic links (or symlinks).
There are two ways to remove these links from your computer:
- Manual Deletion
The links that reference Python folders are in /usr/local/bin. Since the folders that are referenced in the links no longer exist, these links will be broken.
You can see all of the broken symlinks by entering the following command in the Terminal:
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework'
If you’ve only removed a specific version of Python, make sure you replace the path in the above command with the path you used in step #2.
After you see all the broken links, use these commands to delete them:
To enter the directory:
cd /usr/local/bin
To delete the broken links:
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework' | awk '{print $9}' | tr -d @ | xargs rm*
If the path in the command above is different from the path, you used in step #2, replace the path in the command above with the one you used. After you run these commands, the installed Python version will be removed from your Mac.
- Using Homebrew
You can also remove the broken symlinks from your computer using Homebrew. If you don’t have it installed, run the following command to install it:
/bin/bash -c "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Finding broken links is much easier with Homebrew. To find them, run this command:
brew doctor
A list of broken symlinks will appear. You can then use the following command to remove them:
brew cleanup
How To Uninstall Python From Linux?
Linux is similar to macOS – in that Python comes pre-installed on the operating system. Further, removing the pre-installed version of the software causes the OS to malfunction. Typically, the Graphical Display Manager fails when Python is uninstalled from Linux.
For this reason, you can only uninstall the Python versions that you installed manually. To remove the version of Python, you installed, use the following command on the Terminal:
sudo apt purge -y python2.x-minimal
You can remove Python 3 from Linux distros using this command:
sudo ln -s /usr/bin/python3 /usr/bin/python
Uninstall/Remove Python Packages/Modules using pip Command
Have you installed Python packages or modules leveraging the pip commands? If so, here is a guide for you on how to remove Python packages or modules using the pip uninstall command.
Syntax:
pip uninstall requests
- Open the Terminal on your Mac system or command prompt (CMD) on Windows.
- Let us say that you need to uninstall or delete the requests module. Simply type pip uninstall requests.
- You need to confirm the deletion of the package as you see Process (y/n)? by pressing y and Enter or return.
The package will be removed.
Finally Removing Python
So, this was our step-by-step guide on how to install Python for various types of operating systems, such as Windows, macOS, and Linux. On the Windows system, you can remove Python through the control panel and command prompt. Also, on the macOS platform, you can remove Python through Applications and also through Terminal. Each of these procedures may vary in your particular scenario, but the basic idea behind them is similar.

Sameeksha is a freelance content writer for more than half and a year. She has a hunger to explore and learn new things. She possesses a bachelor’s degree in Computer Science.