7

Before asking this question, I tried a lot of methods. I mainly focus on these posts.

How to find all python installations on mac os x and uninstall all but the native OS X installation

How to clean iPython environment so I can start over with Jupyter and Python 3.x?

I also tried

conda install anaconda-clean
anaconda-clean --yes
rm -rf ~/anaconda3

brew cleanup python3

But I still have a number of python versions left

GZs-MacBook-Pro:bin gz$ which python
/usr/bin/python
GZs-MacBook-Pro:bin gz$ which python3
/usr/bin/python3
GZs-MacBook-Pro:bin gz$ ls /System/Library/Frameworks/Python.framework/Versions
2.3 2.5 2.6 2.7 Current
GZs-MacBook-Pro:bin gz$ ls /Library/Frameworks/Python.framework/Versions
ls: /Library/Frameworks/Python.framework/Versions: No such file or directory
GZs-MacBook-Pro:bin gz$ ls -l /usr/bin/python*
lrwxr-xr-x  1 root  wheel     75  9 Oct 23:42 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel     82  9 Oct 23:42 /usr/bin/python-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x  1 root  wheel     75  9 Oct 23:42 /usr/bin/python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel     75  9 Oct 23:42 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel     82  9 Oct 23:42 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x  1 root  wheel  31456  5 Dec 04:32 /usr/bin/python3

How can I remove the others python versions except for the original one on the OS X?

user8314628
  • 1,952
  • 2
  • 22
  • 46

2 Answers2

0

For Mac......

First of all, if Python is running, you are supposed to quit related processes before performing uninstall. And there are multiple ways you can take to exit out of Python:

(1) Right click on its icon on the Dock, and then choose the Quit option;

(2) Open a Python window, and choose Quit from the Apple menu on the left top;

(3) Launch Activity Monitor, select the process with the name of Python in the list, then click the “X” button on the upper left corner, and click Quite button in the pop-up dialog. If the app fails to quit, then try Force Quite in Activity Monitor.

After that you can carry out the standard uninstall, and two options are available here.

Option 1: remove Python from Launchpad Open Launchpad, and type Python in the search box on the top. Click and hold Python icon that appears until it starts to wiggle. Click the “X” icon that appears on the left upper corner of Python icon, and click on the Delete button in the confirmation dialog to execute the uninstallation.

Once you click the Delete button, the uninstall will be handled instantly, and there is no need to empty the Trash afterwards. If you install Python through the App Store and your system is OS X lion or later, you can take this approach to easily uninstall it.

Option 2: delete Python to the Trash Open the Finder, and click on Applications in the sidebar to navigate to the folder. Locate and select Python, then drag the icon to the Trash and drop it there. Right click the Trash icon and choose Empty Trash to perform the uninstall.

CodeWithYash
  • 223
  • 1
  • 15
-2

For Windows.......

You have to follow 2 ways:-

Firstly, you can.....

    • Go to Control Panel and select Add or Remove Programs.

    • Assuming you have an older version X.Y installed, scroll through the list of programs, and for each Python X.Y package that has been installed, select it in the list and click Remove.

    • Note that most packages will be listed as Python X.Y package_name- package_version, such as Python 2.5 numpy-1.0.4, but a few packages such as wxPython, listed as wxPython 2.8.7.1 (unicode) for Python 2.5, may not follow that convention, necessitating that you search the entire program list for packages.

    • The directory C:\PythonXY\ will still exist, so it is recommended that that directory be deleted to avoid confusion (make sure any code you have in there is backed up before deleting the directory!!!) Remove any shortcuts to Python X.Y or IPython that may still be under the Start menu.

Secondly, you can....

    • Type "IDLE" on the Start menu.
    • Note that, please select the version you want to delete.
    • Right-click on the application it has found on your computer.
    • Select "Open file location".
    • In the Windows explorer, right-click on the IDLE shortcut.
    • Select "Properties"
    • At the beginning of the field "Target", you should see the location of the "pythonw.exe" file.
    • "python.exe" should be right beside it.
    • You can uninstall these files or the whole folder.

Thank You.

CodeWithYash
  • 223
  • 1
  • 15