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.
Uninstall Python on Windows
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.
- Open Control Panel
- Click on Uninstall a Program
- Scroll down till you see the installed Python version and Select it and click uninstall for each version.
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.
- Click on the Windows button and search “Environment Variables“.
- In the Environment Variables window, click on Path variable in the system variable section, click the edit button.
- Look for the path of the Python bin folder and remove it from the path.
And you are done. This is going to Uninstall Python from the Windows machine.
Uninstall Python on Mac
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.
Uninstall Python on Linux (Ubuntu)
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.
# Remove python2 sudo apt purge -y python2.7-minimal # You already have Python3 but # don't care about the version sudo ln -s /usr/bin/python3 /usr/bin/python # Same for pip sudo apt install -y python3-pip sudo ln -s /usr/bin/pip3 /usr/bin/pip # Confirm the new version of Python: 3 python --version
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.
The post How to Uninstall Python on Windows, Mac and Linux appeared first on The Crazy Programmer.
from The Crazy Programmer https://ift.tt/3fdTxhk
Comments
Post a Comment