深入研究Python 编程的世界 是一项令人兴奋的冒险,它允许您探索和创建从简单脚本到复杂网络应用程序的项目。但有时,为了系统清理或安装不同版本,您可能需要完全卸载来自 Windows PC 的 Python 。
从计算机中删除 Python 并不像单击“卸载”那么简单。有几个步骤需要遵循,即使跳过一个步骤也可能会在系统上留下残留文件。以下是如何从 Windows PC 上完全卸载 Python,使其保持干净并为接下来发生的任何事情做好准备。

找到您的Python安装
第一步是找到 Python 在您的 PC 上的安装位置。在命令提示符 中输入where python即可找到安装路径。

Python 安装在多个位置是很正常的,这通常是由于不同版本和发行版的 Python 安装方式造成的。请记住文件路径,因为稍后您将需要它们。
如何卸载 Python
要卸载 Python,请从“设置”应用启动。


卸载将开始,并且不需要太长时间即可完成。如有必要,请对任何其他 Python 应用程序(例如 Python 启动器)重复这些步骤。
卸载 Python 后,返回命令提示符并再次运行 where python 命令。如果返回包含Python的文件路径,则表示未完全卸载。

在我们的例子中,AppData\Local\Microsoft\WindowsApps 文件路径中残留了一些内容。这是因为当您在安装过程中选择“将 Python 添加到路径”选项时,Windows 上的 Python 安装程序会在此路径中设置 Python 可执行文件。
在文件资源管理器中,我们有两个文件:python.exe和 python3.exe。

让我们删除它们。



它们现已成功卸载。您可以通过再次运行 where python 来再次检查是否安全。如果返回信息:无法找到给定模式的文件,则 Python 已从您的 PC 中完全卸载。
删除您的 Pip 包
当您使用标准卸载过程卸载 Python 时,它不会自动删除您安装的 pip 软件包。这些包存储在单独的目录中,在卸载过程中不会被删除。
您可以通过打开文件资源管理器并导航到 AppData\Local\Porgrams来删除 pip 包。您将看到一个名为“Python”的文件夹。右键单击该文件夹,然后单击上下文菜单中的垃圾桶图标将其删除。

如果您不删除此文件夹,则重新安装 Python 时将拥有相同的 pip 包。
A Fresh Slate
请记住,这不仅仅是主要的 Python 卸载 - 不要忘记那些往往保留在 WindowsApps 文件夹中的 Python 和 Python3 文件以及位于其自己目录中的经常被忽视的 点包 。确保这些元素也被删除对于完全卸载至关重要。
现在你已经完成了——彻底的 Python 清理。现在,您的 PC 已准备好应对接下来发生的任何事情:系统清理、全新的 Python 安装或全新的编程语言。
.