Many times we ran into problems where nothing related to Python seems working fine and we want to uninstall it completely and re-install it to remove the problem.
So, in this post, we are going to see How to uninstall Python on Windows, Mac and Linux.
Uninstalling Python on Windows is an easy task. You just need to follow some steps and you are good to go.
Below are the steps to uninstall Python from Windows.
Once you are done with the above step, you are left with one final step; Removing it from Path.
Although the python uninstaller removes itself from the path, it’s recommended to manually check the path to be sure.
To remove Python from the system path, follow the below steps and it will be removed permanently.
And you are done. This is going to Uninstall Python from the Windows machine.
Mac ships with Python pre-installed and it is a very bad idea of uninstalling them.
If you try to uninstall the pre-installed Python v2.7 or above, it may break your operating system. I recommend not touching it.
If you’ve installed any third party python framework, you can follow the below steps.
Open your terminal and paste the below commands.
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
Remove the Python 2.7 applications directory
sudo rm -rf "/Applications/Python 2.7"
Remove the symbolic links, 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
You can find the complete details here on Stackoverflow.
The same problem may arise if you’ll try to uninstall pre-installed Python in your Linux/Ubuntu. It is not recommended to remove the default Python from Ubuntu.
It can cause the Graphical Display Manager to fail because of uninstalling Python.
You can only uninstall Python which you installed manually.
Below is the command for uninstalling Python.
Sometimes you also have to update your apt repo list. Here is the command for the same.
sudo apt get update
Well, this was all about how to Uninstall Python and I hope you understood uninstalling Python for your OS.
If you have found this post helpful, please share it with your friends or colleagues who are looking for python programming.
And if you have started with Python development and stuck in some kind of problem or bug, you can leave your comment here and we will get back to you soon.