To completely uninstall Python and all its packages on Windows, follow these steps:

1. Uninstall Python via the Installer

  • If you still have the original Python installer (e.g., python-3.11.0-amd64.exe), run it again and select "Uninstall". This is more reliable than using "Add or Remove Programs" and ensures a clean removal of the core Python installation.

2. Remove Python from PATH and Environment Variables

  • Open System Properties > Environment Variables.

  • Under System Variables, edit the Path variable and remove any entries pointing to Python (e.g., C:\Python311\, C:\Python311\Scripts\, or C:\Users\<username>\AppData\Local\Programs\Python\Python311\).

  • Remove any PYTHONPATH, PYTHONHOME, or similar variables if present.

3. Delete Remaining Python Files and Folders

  • Manually delete these folders if they exist:

    • C:\Users\<username>\AppData\Local\Programs\Python\

    • C:\Users\<username>\AppData\Roaming\Python\

    • C:\Users\<username>\AppData\Local\Microsoft\WindowsApps\ → Delete python.exe, python3.exe, and pip.exe if present.

4. Uninstall All pip-Installed Packages

  • Open Command Prompt and run:

    pip freeze > packages.txt
  • Edit packages.txt and remove setuptools and wheel (they are required for pip to function).

  • Run:

    pip uninstall -r packages.txt -y
  • Delete packages.txt after completion.

5. Verify Complete Removal

  • Open a new Command Prompt and run:

    where python
    where pip
  • If you see "INFO: Could not find files for the given pattern(s)", Python and pip are fully removed.

⚠️ Note: If you don’t have the original installer, download the latest Python installer from python.org and use the "Modify" option to uninstall. This method ensures all components are removed properly.

If you uninstall from the control panel, it should remove all packages with it. To ensure that your path doesn't contain your old python when you try and use anaconda, you should remove Python from your path. In windows 10:

  1. From desktop go bottom left and find the menu.
  2. Click system, then Advanced System Settings
  3. In this window, go to the Advanced tab and click on the environment variables button.
  4. From there you can edit your Path, with the edit button.
  5. Make sure there is no reference to Python here. Also, all variables are separated by a ; so make sure all syntax is good before saving.
  6. Install anaconda and at the end of the install it should ask if you want to make it the default Python. Say yes and every time you or another program asks for Python, it will get pointed to anaconda.
Answer from Nick H on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › how can i clear all installed python modules/packages from my system?
r/learnpython on Reddit: How can i clear all installed python modules/packages from my system?
April 27, 2024 -

I am trying to fresh start to learn python on my linux machine. Previously i tried some python and installed some modules(or packages?, i mean additional libraries) with python -m or pip command.

Now I learnt i need to install packages to a virtual environment with using pip install --user packagename. I want to clear packages that i installed to system locations but how can i find and uninstall them?

I checked /usr/lib/python3.11 /home/myuser/.local/lib/python3.11 dirs and there are more than hundred packages. And i dont know if these are the modules that i installed or some of them system modules?

Discussions

python - How do I remove all packages installed by pip? - Stack Overflow
Since it's a set of files it doesn't seem to know how to handle their presence, and rather than uninstalling anything it makes a local directory structure under MYENV complete with: ` > New python executables in MYENV/bin/python3.4 > Also creating executable in MYENV/bin/python > Installing setuptools, pip, wheel...done.` But MYENV hasn't reset the environment! 2015-08-04T06:35:30.773Z+00:00 ... Uninstall all the packages ... More on stackoverflow.com
🌐 stackoverflow.com
Could you pls tell me how to uninstall python 3.12.4(64 bit)
Hi friends, I tried to install phthon 3.12.4 (64 bit) but I think I failed to install it successfully , as when I uninstalled it , it came with the reminder as attached, so that I can not uninstall it till now , can any friend help me pls? Thank you in advance. More on discuss.python.org
🌐 discuss.python.org
0
0
July 26, 2024
How can i do a FULL uninstall of python?
Remove Python executable: Delete the Python executable from your system. The location of the executable may vary based on your operating system. Common locations include C:\PythonXX on Windows or /usr/bin/python on Linux. Delete the entire Python folder to remove all versions and components. Remove environment variables: If you have set any environment variables related to Python, such as PYTHONPATH, you should remove them. This step is optional but recommended for a clean uninstallation. Delete Python-related entries from PATH: Edit your system's PATH environment variable and remove any entries that point to the Python installation directories. These entries typically include paths like C:\PythonXX or /usr/bin/python. Remove Python packages: If you installed any Python packages using pip, you should uninstall them to clean up your system. Open a terminal or command prompt and use the following command: pip uninstall package_name Replace package_name with the name of the package you want to uninstall. Repeat this command for each package you wish to remove. Delete Python-related files: Manually search for and delete any remaining Python-related files or directories on your system. These may include configuration files, cached files, or any additional files you created. Verify removal: After completing the above steps, restart your computer and verify that Python has been completely uninstalled. Open a terminal or command prompt and try running the following command: python --version If Python is no longer installed, you should receive an error message stating that the command is not recognized. More on reddit.com
🌐 r/techsupport
7
4
June 26, 2023
Need advice on how to completely uninstall python
settings -> apps and features -> find the python version and uninstall. That's unlikely to fix whatever your issue is, but won't hurt to uninstall and re-install. More on reddit.com
🌐 r/learnpython
9
2
September 19, 2024
🌐
ActiveState
activestate.com › home › resources › quick read › how to uninstall python packages
How to Uninstall Python Packages - ActiveState
March 14, 2025 - You can then uninstall all packages at once by running: ... What is the difference between pip uninstall vs. pipenv uninstall? While both commands (pip uninstall <packagename> and pipenv uninstall <packagename> will uninstall packages, you should ...
🌐
Educative
educative.io › answers › how-to-uninstall-python
How to uninstall Python
This command removes the Python 3.11 package and any other packages that were installed as dependencies but are no longer needed. You can replace python3.11 with any desired version that you wish to uninstall. Let's test the above command and verify whether it can uninstall Python or not. After running the command, please execute the python --version command to confirm the uninstallation of Python ... Copyright ©2026 Educative, Inc. All ...
🌐
pip
pip.pypa.io › en › stable › cli › pip_uninstall
pip uninstall - pip documentation v26.0.1
python -m pip uninstall [options] <package> ... python -m pip uninstall [options] -r <requirements file> ...
Top answer
1 of 16
1980

I've found this snippet as an alternative solution. It's a more graceful removal of libraries than remaking the virtualenv:

pip freeze | xargs pip uninstall -y

In case you have packages installed via VCS, you need to exclude those lines and remove the packages manually (elevated from the comments below):

pip freeze --exclude-editable | xargs pip uninstall -y

If you have packages installed directly from github/gitlab, those will have @. Like:

django @ git+https://github.com/django.git@<sha>

You can add cut -d "@" -f1 to get just the package name that is required to uninstall it.

pip freeze | cut -d "@" -f1 | xargs pip uninstall -y
2 of 16
1027

This will work for all Mac, Windows, and Linux systems. To get the list of all pip packages in the requirements.txt file (Note: This will overwrite requirements.txt if exist else will create the new one, also if you don't want to replace old requirements.txt then give different file name in the all following command in place requirements.txt).

pip freeze > requirements.txt

Now to remove one by one

pip uninstall -r requirements.txt

If we want to remove all at once then

pip uninstall -r requirements.txt -y

If you're working on an existing project that has a requirements.txt file and your environment has diverged, simply replace requirements.txt from the above examples with toberemoved.txt. Then, once you have gone through the steps above, you can use the requirements.txt to update your now clean environment.

And For single command without creating any file as @joeb suggested

pip uninstall -y -r <(pip freeze)
Find elsewhere
🌐
Python.org
discuss.python.org › python help
Could you pls tell me how to uninstall python 3.12.4(64 bit) - Python Help - Discussions on Python.org
July 26, 2024 - Hi friends, I tried to install phthon 3.12.4 (64 bit) but I think I failed to install it successfully , as when I uninstalled it , it came with the reminder as attached, so that I can not uninstall it till now , can any…
🌐
Bobby Hadz
bobbyhadz.com › blog › python-remove-uninstall-all-packages-installed-by-pip
Remove/uninstall all packages installed by pip in Python | bobbyhadz
Copied!# 👇️ Optionally save the packages that are to be removed pip freeze > to_remove.txt # 👇️ Remove/uninstall all packages installed by pip pip uninstall -y -r <(pip freeze) The command uses pip freeze to get a list of the installed ...
🌐
Python Central
pythoncentral.io › how-to-uninstall-python
How to Uninstall Python | Python Central
February 5, 2025 - The uninstallation wizard will launch, and after you confirm your decision to uninstall Python, it will be removed from your computer. To remove Python from your computer completely, you will need to remove Python from Path.
🌐
Reddit
reddit.com › r/techsupport › how can i do a full uninstall of python?
r/techsupport on Reddit: How can i do a FULL uninstall of python?
June 26, 2023 -

Dear u/daddy_spez,
I am going to reinstall python but there are things the uninstaller just doesn't remove.

The pip packages are there, the PATH is there, some leftover files are still there and who know what else is in the system.

I want to fully uninstall python so i can reinstall it and all the packages i got, if i re-install while all these things are still there it will create conflicts and things that once worked will be bugged.

Top answer
1 of 1
1
Remove Python executable: Delete the Python executable from your system. The location of the executable may vary based on your operating system. Common locations include C:\PythonXX on Windows or /usr/bin/python on Linux. Delete the entire Python folder to remove all versions and components. Remove environment variables: If you have set any environment variables related to Python, such as PYTHONPATH, you should remove them. This step is optional but recommended for a clean uninstallation. Delete Python-related entries from PATH: Edit your system's PATH environment variable and remove any entries that point to the Python installation directories. These entries typically include paths like C:\PythonXX or /usr/bin/python. Remove Python packages: If you installed any Python packages using pip, you should uninstall them to clean up your system. Open a terminal or command prompt and use the following command: pip uninstall package_name Replace package_name with the name of the package you want to uninstall. Repeat this command for each package you wish to remove. Delete Python-related files: Manually search for and delete any remaining Python-related files or directories on your system. These may include configuration files, cached files, or any additional files you created. Verify removal: After completing the above steps, restart your computer and verify that Python has been completely uninstalled. Open a terminal or command prompt and try running the following command: python --version If Python is no longer installed, you should receive an error message stating that the command is not recognized.
🌐
Help Desk Geek
helpdeskgeek.com › home › how-to › how to completely uninstall python on your windows pc
How to Completely Uninstall Python on Your Windows PC
January 31, 2025 - You’ll see a folder named “Python.” Right-click this folder and click the trash can icon from the context menu to delete it. If you don’t delete this folder, you’ll have the same pip packages when reinstalling Python.
🌐
MiniTool Partition Wizard
partitionwizard.com › home › partition manager › how to uninstall python from windows & mac & linux
How to Uninstall Python from Windows & Mac & Linux
November 30, 2024 - This will remove Python and all Python files from the path. But you can also check that manually. Here are the steps: Click on Windows. Type Environment Variables and hit Enter. Select the Environment Variable on the bottom right. Under the System Variable section, click on the Path and select Edit. Locate the bin folder of Python. Select that folder and click Delete to remove it from the path. ... It is not advisable to uninstall Python on Mac or Linux because it might harm the Operating System or Graphical Display Manager.
🌐
MiniTool
minitool.com › home › news › pip uninstall all python packages in windows – see a full guide!
PIP Uninstall All Python Packages in Windows, Learn Essentials
November 26, 2024 - Step 3: Type cd followed by the Python Scripts path and here is an example – cd C:\Users\cy\AppData\Local\Programs\Python\Python311\Scripts. Then, press Enter. Step 4: Execute this command – pip uninstall package_name.
🌐
Quora
quora.com › How-do-you-uninstall-all-of-your-Python-packages-at-once-with-Pip
How to uninstall all of your Python packages at once with Pip - Quora
Answer (1 of 2): It would be useful to check if some of your Python packages where installed using your package manager (i.e. dnf or apt). Saw an earlier response with the commands you need, I’ll add a second option where you can store a list of uninstalled packages for your reference: [code ]p...
🌐
Python Forum
python-forum.io › thread-27135.html
How to fully uninstall Python from Windows?
May 27, 2020 - Hello, For some unknown reason (updating Pip?), I've been getting this warning when using Pip: Quote:c:\>pip3 install mymodule WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://git...
Top answer
1 of 3
41

Please don't.

Ubuntu relies heavily on different Python versions for functionality. New releases of Ubuntu are slowly shifting to Python3, but older versions of Python are still in use.

You can list some important Ubuntu and Gnome packages on your system that depend on Python3, for example, like so:

apt-cache rdepends -i --installed --recurse python3 | \
grep -v " " | sort -u | grep -E "ubuntu|gnome"

On Ubuntu 20.10 desktop, these important packages are among them:

gnome-control-center
gnome-session
gnome-terminal
network-manager-gnome
ubuntu-desktop
ubuntu-desktop-minimal
ubuntu-drivers-common
ubuntu-minimal
ubuntu-release-upgrader-core
ubuntu-release-upgrader-gtk
ubuntu-session
ubuntu-standard
ubuntu-system-service

Moreover, there is no such Python clean state. Each system update and each package you install might bring with it Python related dependencies.

You can however use pip or pip3 to uninstall only packages you previously manually installed and even this is not totally risk free.

If you have already removed Python, try this or this if you need a fix. Chances are little though. If you manage to fix it, you are lucky.

Golden rule... Leave the snake alone.


That being said, use a Python virtual environment for your Python projects and you shouldn't be needing to clean or go back to clean state Ubuntu system Python.

Python virtual environments create an isolated environment for your Python projects. This means that each project can have its own dependencies, regardless of what dependencies the Ubuntu system or other Python projects have.

This feature can be installed for Python3 like so:

sudo apt install python3-venv

To make a Python3 virtual environment for a project, you would first create a directory and cd to it like so:

mkdir my_env && cd my_env

Then, create a new Python3 virtual environment inside the directory like so:

python3 -m venv env

This will create a structure like this:

$tree -L 3

.
└── env
    ├── bin
    │   ├── activate
    │   ├── activate.csh
    │   ├── activate.fish
    │   ├── Activate.ps1
    │   ├── easy_install
    │   ├── easy_install-3.8
    │   ├── pip
    │   ├── pip3
    │   ├── pip3.8
    │   ├── python -> python3
    │   └── python3 -> /usr/bin/python3
    ├── include
    ├── lib
    │   └── python3.8
    ├── lib64 -> lib
    ├── pyvenv.cfg
    └── share
        └── python-wheels

To use this environment, activate it like so:

source env/bin/activate

Your shell prompt will show (env) like so:

(env) $

During this, Python3 commands, module installs or modifications will be contained locally in this virtual environment.

When you are done, deactivate this Python3 virtual environment like so:

deactivate

You are now back to the system-wide Python3 and commands will take effect globally so be careful.

2 of 3
4

Here's a method:

get 'apt-cache' to show reverse-dependencies, recursively, of the core python library; "--installed" to limit to packages installed, and "-i" to show only important dependencies (i.e. not suggests or recommends).

The 'grep' filters out all except package names, then sorted uniquely (there'll be many duplicates), then use 'xargs' to append the resulting list of lines as parameters to 'apt-mark auto', which marks them as automatically installed.

'Automatically installed' packages will be removed by 'apt autoremove' when no more packages depend on them.

apt-cache --installed  -i --recurse rdepends \
  libpython3.8-minimal | \
    grep "^  " | sort -u | \
      xargs apt-mark auto

apt autoremove

This will show the long list of packages to be removed, be careful of unexpected dependencies removing packages you want to keep!

Say 'no' to that prompt and 'apt-mark manual ThisOne' for all the packages you need to keep, and run 'apt autoremove' again (and check again!) to get rid of the junk.

🌐
Cloudinary
cloudinary.com › home › how do i uninstall python (without breaking everything)?
How Do I Uninstall Python (Without Breaking Everything)?
August 19, 2025 - If your uninstall process breaks your Cloudinary integration, simply create a new environment and reinstall your packages. ... Knowing how to uninstall Python safely is a key part of keeping your development environment clean and functional.