如何从 Windows 机器中完全删除 Python?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3515673/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to completely remove Python from a Windows machine?
提问by Jonathan
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. e.g. "setup.py install" for certain packages don't recognize the "install" parameter and other odd phenomena...
我安装了 Python 2.7 和 Python 2.6.5。我不知道出了什么问题,但与 Python 相关的任何东西似乎都不再起作用了。例如,某些软件包的“setup.py install”无法识别“install”参数和其他奇怪的现象...
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.
我想从我的系统中完全删除 Python。
我尝试运行 2.7 和 2.6 msi 文件并选择删除 Python,然后仅运行 2.6 并重新安装它。东西还是不行。
How do I completely remove Python - from everything? (!)
如何从所有内容中完全删除 Python?(!)
I would not like to reinstall my entire machine just because of the Python install...
我不想仅仅因为安装了 Python 就重新安装我的整个机器......
采纳答案by Alex Bliskovsky
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
您还必须查看系统路径。Python 将自己放在那里并且不会自行删除:http: //www.computerhope.com/issues/ch000549.htm
Your problems probably started because your python path is pointing to the wrong one.
您的问题可能开始是因为您的 python 路径指向错误的路径。
回答by Nick T
Almost all of the python files should live in their respective folders (C:\Python26and 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.
几乎所有的 python 文件都应该位于它们各自的文件夹(C:\Python26和C:\Python27)中。如果您勾选“将此用作默认安装”框,一些安装程序 (ActiveState) 还会关联.py*文件并将 python 路径添加到%PATH%安装中。
回答by dash-tom-bang
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.)
运行 ASSOC 和 FTYPE 以查看您的 py 文件与什么相关联。(这些命令是 cmd.exe 的内部命令,因此如果您使用不同的命令处理器 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.)
(我有 32 位和 64 位的 Python 安装,因此是我的本地目录名称。)
回答by ArtOfWarfare
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)
这是步骤(我不精通计算机的女朋友必须为我解决这个问题,但与人们可以在网上找到的所有更复杂的过程不同,这个过程有效)
- Open Control Panel
- Click "Uninstall a Program"
- Scroll down to Python and click uninstall for each version you don't want anymore.
- 打开控制面板
- 点击“卸载程序”
- 向下滚动到 Python 并为您不再需要的每个版本单击卸载。
This works on Windows 7 out of the box, no additional programs or scripts required.
这适用于开箱即用的 Windows 7,不需要额外的程序或脚本。
回答by Jordan Stefanelli
Windows 7 64-bit, with both Python3.4 and Python2.7 installed at some point :)
Windows 7 64 位,同时安装了 Python3.4 和 Python2.7 :)
I'm using Py.exe to route to Py2 or Py3 depending on the script's needs - but I previously improperly uninstalled Python27 before.
我根据脚本的需要使用 Py.exe 路由到 Py2 或 Py3 - 但我之前不正确地卸载了 Python27。
Py27 was removed manually from C:\python\Python27 (the folder Python27 was deleted by me previously)
Py27 是从 C:\python\Python27 手动删除的(之前我删除了文件夹 Python27)
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.
重新安装 Python27 后,它给出了您指定的上述错误。
在安装过程中尝试“删除快捷方式”时,它总是会退出。
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.
我将 Python27 的副本放回原始文件夹中的 C:\Python\Python27,并重新运行了同样失败的 Python27 安装程序。很高兴找到这些项目并删除它们,然后继续安装。
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).
您可以通过打开“regedit”并搜索“Python27”来对此有所了解 - 一个注册表项出现在我的命令外壳缓存中,指向 c:\python\python27\(已被删除并且在搜索时不存在)找到它后的注册表)。
That may help point to previously improperly removed installations.
这可能有助于指出以前不正确删除的安装。
Good luck!
祝你好运!
回答by Ventian
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.
我知道这是一个老问题,但我在 2.7 和 3.5 中遇到了这个问题。虽然 2.7 不会出现在我的默认 Windows 卸载列表中,但它在卸载下的 ccleaner 工具选项卡中显示良好。之后卸载并重新安装,此后编码一直很流畅。
回答by Thelma
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.
我有窗口 7(64 位)和 Python 2.7.12,我通过单击“下载”目录中的 python 安装程序卸载它,然后我选择删除 python,然后单击“完成”。
我还从 c: 驱动器和“我的文档”文件夹中删除了剩余的 python 相关目录和文件,因为我在那里创建了一些文件。
回答by Patrick Mutuku
Uninstall the python program using the windows GUI.
Delete the containing folder e.g if it was stored in C:\python36\make sure to delete that folder
使用 Windows GUI 卸载 python 程序。删除包含文件夹,例如,如果它存储在C:\python36\确保删除该文件夹
回答by Anirudh Prabhakaran
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.
其实很简单。当你安装它时,你必须使用一些 .exe 文件(我假设)来完成它。只需再次运行该 .exe,然后就会有修改 Python 的选项。只需选择“完全卸载”选项,EXE 就会为您彻底清除 python。
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 :)
此外,您可能必须选中“从 PATH 中删除 Python”。默认情况下它被选中,但你也可以检查它以确保:)
回答by angelo.mastro
you can delete it manually.
您可以手动删除它。
- open Command Prompt
cd C:\Users\<you name>\AppData\Local\Microsoft\WindowsAppsdel python.exedel python3.exe
- 打开命令提示符
cd C:\Users\<you name>\AppData\Local\Microsoft\WindowsAppsdel python.exedel 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
where python--> 什么也没产生,您可以从源代码/anaconda 自由安装另一个版本,并且(在将其地址添加到环境变量-> 路径之后)您会发现您刚刚安装的那个 python

