简体   繁体   中英

How to completely remove Python from a Windows machine?

I installed both Python 2.7 and Python 2.6.5. I don't know what went wrong, but nothing related to Python seems to work any more. eg "setup.py install" for certain packages don't recognize the "install" parameter and other odd phenomena...

I would like to completely remove Python from my system.
I tried running the 2.7 and 2.6 msi files and choosing remove Python and then running only 2.6 and reinstalling it. Still stuff don't work.

How do I completely remove Python - from everything? (!)

I would not like to reinstall my entire machine just because of the Python install...

Here's the steps (my non-computer-savvy girlfriend had to figure this one out for me, but unlike all the far more complicated processes one can find online, this one works)

  1. Open Control Panel
  2. Click "Uninstall a Program"
  3. Scroll down to Python and click uninstall for each version you don't want anymore.

This works on Windows 7 out of the box, no additional programs or scripts required.

You will also have to look in your system path. Python puts itself there and does not remove itself: http://www.computerhope.com/issues/ch000549.htm

Your problems probably started because your python path is pointing to the wrong one.

you can delete it manually.

  1. open Command Prompt
  2. cd C:\\Users\\<you name>\\AppData\\Local\\Microsoft\\WindowsApps
  3. del python.exe
  4. del python3.exe

Now the command prompt won't be showing it anymore

where python --> yields nothing, and you are free to install another version from source / anaconda and (after adding its address to Environment Variables -> Path) you will find that very python you just installed

Run ASSOC and FTYPE to see what your py files are associated to. (These commands are internal to cmd.exe so if you use a different command processor ymmv.)

C:> assoc .py
.py=Python.File

C:> ftype Python.File
Python.File="C:\Python26.w64\python.exe" "%1" %*

C:> assoc .pyw
.pyw=Python.NoConFile

C:> ftype Python.NoConFile
Python.NoConFile="C:\Python26.w64\pythonw.exe" "%1" %*

(I have both 32- and 64-bit installs of Python, hence my local directory name.)

I had window 7 (64 bit) and Python 2.7.12, I uninstalled it by clicking the python installer from the "download" directory then I selected remove python then I clicked “ finish”.
I also removed the remaining python associated directory & files from the c: drive and also from “my documents” folder, since I created some files there.

It's actually quite simple. When you installed it, you must have done it using some .exe file (I am assuming). Just run that .exe again, and then there will be options to modify Python. Just select the "Complete Uninstall" option, and the EXE will completely wipe out python for you.

Also, you might have to checkbox the "Remove Python from PATH". By default it is selected, but you may as well check it to be sure :)

Almost all of the python files should live in their respective folders ( C:\\Python26 and C:\\Python27 ). Some installers (ActiveState) will also associate .py* files and add the python path to %PATH% with an install if you tick the "use this as the default installation" box.

If you still have the python installer on your PC, you can double-click on it (run it, it will open the installer window), and select the "Uninstall" option. It will uninstall that python version (if the installer is for Python3.9, then Python3.9 will be uninstalled, if it is for Python3.10, then that version...)

I know it is an old question, but I ran into this problem with 2.7 and 3.5. Though 2.7 would not show up in my default windows uninstall list, it showed up fine in the ccleaner tools tab under uninstall. Uninstalled and reinstalled afterwards and it has been smooth coding ever since.

Uninstall the python program using the windows GUI. Delete the containing folder eg if it was stored in C:\\python36\\ make sure to delete that folder

Windows 7 64-bit, with both Python3.4 and Python2.7 installed at some point :)

I'm using Py.exe to route to Py2 or Py3 depending on the script's needs - but I previously improperly uninstalled Python27 before.

Py27 was removed manually from C:\\python\\Python27 (the folder Python27 was deleted by me previously)

Upon re-installing Python27, it gave the above error you specify.
It would always back out while trying to 'remove shortcuts' during the installation process.

I placed a copy of Python27 back in that original folder, at C:\\Python\\Python27, and re-ran the same failing Python27 installer. It was happy locating those items and removing them, and proceeded with the install.

This is not the answer that addresses registry key issues (others mention that) but it is somewhat of a workaround if you know of previous installations that were improperly removed.

You could have some insight to this by opening "regedit" and searching for "Python27" - a registry key appeared in my command-shell Cache pointing at c:\\python\\python27\\ (which had been removed and was not present when searching in the registry upon finding it).

That may help point to previously improperly removed installations.

Good luck!

  1. Open CMD

  2. To show all packages installed - pip list

  3. To copy the packages name to a file - pip freeze > requirements.txt

  4. To delete all packages - pip uninstall -r requirements.txt -y

  5. Check all packages are removed - pip list

  6. Uninstall pip and other remaining packages

  7. Control panel > Uninstall > Python uninstall (from UI)

Windows 开始菜单 > 设置 > 应用程序 > 应用程序和功能 > 选择应用程序并单击卸载按钮

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM