Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsDo not start by deleting /usr/bin/python3. Linux often uses Python for package-management helpers, desktop tools, installers, and administration scripts. The safe way to uninstall it is to identify which Python you are using, find what installed it, and then remove only that installation.
The commands below cover distribution packages, pyenv, source builds, and virtual environments. If the interpreter belongs to the operating system, keep it unless you are deliberately rebuilding or replacing the distribution.
1. Identify the Python installation first
Open a terminal and run:
command -v python
command -v python3
readlink -f "$(command -v python3)"
python3 -c 'import sys; print(sys.executable)'
These commands show whether python or python3 exists, the real file behind symbolic links, and the executable used by the python3 command.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
Do not assume that python, python3, and a versioned command such as python3.12 refer to the same installation. You may have a distribution Python in /usr/bin, a manually compiled Python in /usr/local/bin, and one or more pyenv versions in your home directory.
Typical locations provide an initial clue:
| Executable location | Likely installation |
|---|---|
/usr/bin/python3 |
Distribution package managed by APT, DNF, Pacman, Zypper, or APK |
/usr/local/bin/python3.x |
Often compiled and installed from source |
~/.pyenv/versions/... |
Managed by pyenv |
A project directory such as ./.venv/bin/python |
Virtual environment |
2. Check whether the package manager owns Python
Use the command for your Linux distribution. The ownership check is more reliable than guessing a package name from the executable.
Debian and Ubuntu
dpkg-query -W -f='${binary:Package}\t${Version}\n' 'python3*'
dpkg -S "$(readlink -f "$(command -v python3)")"
The second command reports the Debian package that owns the actual python3 executable. If it reports a core package such as python3-minimal, treat removal as potentially system-critical.
Free tools Windows power users keep installed
One-click scans. No signup required.
Fedora, RHEL, and CentOS Stream
rpm -qa | grep -E '^python([0-9]|3)'
rpm -qf "$(readlink -f "$(command -v python3)")"
Arch Linux and Arch-based distributions
pacman -Q | grep -E '^python'
pacman -Qo "$(readlink -f "$(command -v python3)")"
openSUSE and SUSE Linux Enterprise
rpm -qf "$(readlink -f "$(command -v python3)")"
Alpine Linux
Alpine normally calls the runtime package python3. Before removing it, inspect its dependencies:
apk info --depends python3
3. Uninstall a nonessential Python package
Only continue if you have identified a separately installed Python package and reviewed what depends on it. Every package manager displays a proposed transaction before it proceeds. Read that list; cancel if it includes your desktop, package manager, administrative tools, or other software you still need.
Debian and Ubuntu: APT
First list the exact package name, then remove that package:
sudo apt remove PACKAGE_NAME
For example, replace PACKAGE_NAME with the package identified by dpkg -S, not automatically with python3. apt remove removes packaged files but normally leaves small modified system-configuration files. It does not remove files or configuration stored in your home directory.
To also remove packaged configuration files, use:
sudo apt purge PACKAGE_NAME
Afterward, APT can identify dependencies that are no longer required:
sudo apt autoremove
Review the entire removal list before confirming. A package installed originally as a dependency may still be something you want.
Do not run:
sudo apt remove 'python3*'
The quoted wildcard is passed to APT, where it can match runtimes, libraries, development packages, and Python-based applications. It is much broader than removing one interpreter.
Fedora, RHEL, and CentOS Stream: DNF
sudo dnf remove PACKAGE_NAME
DNF also accepts rm as an alias, but remove is clearer:
sudo dnf rm PACKAGE_NAME
To remove dependencies that are no longer needed, run this separately:
sudo dnf autoremove
Use --noautoremove when you want to prevent automatic removal of dependencies:
sudo dnf --noautoremove remove PACKAGE_NAME
Avoid sudo dnf remove 'python*' or sudo dnf remove python* unless you have inspected every selected package. DNF’s deprecated erase forms should also be avoided; use remove.
Arch Linux: Pacman
For a basic removal:
sudo pacman -R PACKAGE_NAME
To remove dependencies that are no longer required:
sudo pacman -Rs PACKAGE_NAME
To remove unneeded dependencies and avoid saving most configuration files as .pacsave:
sudo pacman -Rns PACKAGE_NAME
Do not remove Arch’s python package merely because the command is named python3. Confirm ownership with pacman -Qo and inspect pacman’s proposed transaction.
Recommended Free Tools
openSUSE and SLE: Zypper
sudo zypper remove PACKAGE_NAME
SUSE splits the interpreter, standard library, development files, and applications into separate packages. Find the owning RPM package first and avoid broad patterns such as python3-*.
Alpine Linux: APK
doas apk del PACKAGE_NAME
If your system uses sudo instead of doas:
sudo apk del PACKAGE_NAME
Use only the package name selected after checking Alpine’s dependency information and removal transaction.
4. Remove a Python version installed with pyenv
Pyenv installs separate Python builds beneath its own directory and does not replace the distribution Python. List the versions it manages:
pyenv versions
Remove one version by specifying its exact version:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
pyenv uninstall VERSION
For example:
pyenv uninstall 3.12.4
Pyenv also documents manually removing a version directory:
rm -rf "$(pyenv prefix VERSION)"
Prefer pyenv uninstall, because plugins can perform additional cleanup. For example, pyenv-virtualenv may remove virtual environments linked to that version.
Disable pyenv without deleting its Python versions
If you only want new shells to use the system Python, remove the pyenv initialization lines from the relevant startup file, commonly ~/.bashrc or ~/.zshrc. Look for lines containing pyenv init and pyenv-related PATH changes. Start a new shell after editing.
Completely uninstall pyenv
This deletes all Python versions stored by pyenv:
rm -rf "$(pyenv root)"
Then remove the pyenv initialization and PATH lines from your shell startup files. If Homebrew installed pyenv, remove that package separately:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →brew uninstall pyenv
A common failure is deleting ~/.pyenv but leaving eval "$(pyenv init -)" in .bashrc or .zshrc. New shells may then show missing-command errors or stale PATH entries.
5. Remove Python compiled from source
A source-built Python is not registered with APT, DNF, Pacman, or another distribution package database unless you separately created a package for it. There is no universal uninstall command.
Rank #4
Do not run:
sudo rm -rf /usr/bin/python*
That can delete distribution-managed executables and break system scripts.
If the build directory still exists, check whether its build system supplied an uninstall target:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallmake help | grep -i uninstall
make uninstall is not a guaranteed CPython interface, so do not run it unless the project explicitly provides and documents it.
Find the installation prefix and inspect it before deleting anything:
./configure --help | grep -E 'prefix|exec-prefix'
find /usr/local -maxdepth 3 \( -name 'python3*' -o -name 'pip3*' \)
A source installation under /usr/local may include the executable, standard-library files, headers, shared libraries, and script entry points. Deleting only /usr/local/bin/python3.x leaves an incomplete installation behind. If you recorded an installation manifest or used a tool such as checkinstall, use that record to remove the exact files.
6. Delete virtual environments separately
A virtual environment is not the Python installation itself. It contains links or references to the interpreter used to create it. If that interpreter is removed, the environment’s scripts may fail with an invalid shebang or a “No such file or directory” error.
From the project directory, remove an environment you no longer need:
rm -rf .venv
Replace .venv with the actual environment directory. Do not delete a directory until you have confirmed it contains only the environment and not project source or data.
Do not use:
pip uninstall python
pip removes Python distribution packages installed in the selected environment. It is not the operating-system package manager and cannot uninstall the CPython interpreter.
Best Value
7. Verify the result
After removal, open a new terminal or refresh the shell’s command lookup:
hash -r
command -v python
command -v python3
python3 --version
If python3 still works, that may be correct: another installation remains, such as the system Python, a pyenv version, or a different versioned executable. Trace it again:
readlink -f "$(command -v python3)"
python3 -c 'import sys; print(sys.executable)'
If a shell startup file still points to a deleted pyenv installation, remove the stale initialization lines. If distribution tools now fail, stop deleting files and restore the package through your distribution’s recovery procedure; manually recreating /usr/bin/python3 is not a repair.
Commands at a glance
| Installation | Identify it | Remove it |
|---|---|---|
| APT package | dpkg -S /path/to/python |
sudo apt remove PACKAGE_NAME |
| DNF package | rpm -qf /path/to/python |
sudo dnf remove PACKAGE_NAME |
| Pacman package | pacman -Qo /path/to/python |
sudo pacman -R PACKAGE_NAME |
| Zypper package | rpm -qf /path/to/python |
sudo zypper remove PACKAGE_NAME |
| APK package | Check package dependencies | sudo apk del PACKAGE_NAME |
| pyenv | pyenv versions |
pyenv uninstall VERSION |
| Virtual environment | Inspect the project directory | rm -rf .venv |
FAQ
Can I uninstall Python from Linux with sudo apt remove python3?
Not safely as a general rule. On Debian and Ubuntu, python3 may be required by system utilities or other important packages. Identify the owning package and review APT’s complete removal list before confirming.
Will removing Python break Linux?
Removing the distribution-provided interpreter or its dependencies can break system tools. Removing an isolated pyenv version, source build, or project virtual environment normally does not affect the operating system.
Does pip uninstall python remove Python?
No. Pip manages Python packages inside a selected environment. Use the distribution package manager, pyenv, or the cleanup method associated with the original installation.
Free tools Windows power users keep installed
One-click scans. No signup required.
How do I know which Python Linux is using?
Run command -v python3, readlink -f "$(command -v python3)", and python3 -c 'import sys; print(sys.executable)'. These reveal the command path and the executable actually launched.
Can I delete /usr/bin/python3 manually?
No. Manual deletion bypasses the package database, can break system scripts, and leaves the package installation inconsistent. Remove a package through the distribution’s package manager instead.
Why does Python still run after I removed one version?
Linux can have several independent installations. A system Python, pyenv version, source-built interpreter, and virtual environment can all coexist. Run the identification commands again to find the one still earlier in your PATH.
The Bottom Line
The safe sequence is: identify the executable, determine who owns it, review the package manager’s removal plan, and remove only the intended installation. Keep the distribution Python unless you are certain it is isolated and nonessential; use pyenv or a virtual environment when you need to manage versions without touching the operating system.
Python’s documentation explains why Linux distributions commonly include Python and how Unix installations work: Why is Python Installed? and Using Python on Unix platforms.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

