You installed Python 3.14 or 3.15 alongside Ubuntu’s system python3—for example with the Deadsnakes PPA or source altinstall. When you no longer need that extra version, remove only what you added. Do not purge Ubuntu’s default python3 package to “uninstall Python” on the whole system.
This guide routes uninstall steps by how the interpreter was installed, verifies that apt and system python3 still work, and covers virtualenv cleanup.
Tested on: Python 3.14.6 source
altinstallremove and reinstall; systempython33.13.3; kernel 6.14.0-37-generic; Ubuntu 25.04.
The source altinstall uninstall block, venv create/delete, and post-removal checks below were run on this host (python3.14 at /usr/local/bin, then removed, then reinstalled to /usr/local/bin/python3.14 with venv at ~/venvs/py314). Deadsnakes apt remove --purge commands match package names on Launchpad for jammy and noble; that purge path was not re-run here because this VM is Ubuntu 25.04 (plucky), which the PPA does not publish.
Which removal path should you use?
| How it was installed | What to remove | Leave alone |
|---|---|---|
| Deadsnakes PPA | python3.14 / python3.15 apt packages |
python3, python3-minimal, libpython3* from Ubuntu |
Source make altinstall |
Files under /usr/local for that version |
/usr/bin/python3 and /usr/lib/python3* |
| pyenv | pyenv uninstall <version> |
System python3 and other pyenv versions you still need |
| Virtual environment only | rm -rf the venv directory |
Any system or /usr/local interpreter you still use |
Pick one major section below. Removing a venv does not uninstall the underlying Python binary.
Do not remove Ubuntu system python3
These packages (and their dependencies) must stay on a normal Ubuntu desktop or server:
python3python3-minimallibpython3-stdliband relatedlibpython3*packages tied to the release default
Avoid commands such as:
# Do not run these on Ubuntu system Python
sudo apt remove python3
sudo apt purge python3-minimal
sudo rm /usr/bin/python3If apt, add-apt-repository, or cloud-init break after removing system Python, reinstall the metapackages Ubuntu expects (for example sudo apt install --reinstall python3 python3-minimal) from a recovery shell or live media—not by deleting more Python packages at random.
Identify how your extra Python was installed
Replace 3.14 with 3.15 if that is the version you added.
command -v python3.14
python3.14 --version 2>/dev/null
dpkg -l 'python3.14*' 2>/dev/null | grep ^iiExample when Deadsnakes packages are installed:
/usr/bin/python3.14
Python 3.14.6
ii python3.14 3.14.6-1+noble1 amd64 ...
ii python3.14-venv ...Example when built with source altinstall:
/usr/local/bin/python3.14
Python 3.14.6If dpkg -l shows no python3.14 packages but which points to /usr/local/bin, use the source-removal section.
Remove Python installed from the Deadsnakes PPA
Use this when install latest Python on Ubuntu with sudo apt install python3.14 (or python3.15).
Python 3.14 (stable)
List related packages before removal:
dpkg -l 'python3.14*' | grep ^iiRemove the interpreter and common companion packages:
sudo apt remove --purge python3.14 python3.14-venv python3.14-dev
sudo apt autoremove --purgeIf dpkg -l still lists other python3.14-* packages (for example python3.14-distutils), purge them the same way.
Verify:
command -v python3.14
python3 --version
sudo apt updateExpected after a clean removal on Ubuntu 24.04:
$ command -v python3.14
$ python3 --version
Python 3.12.3On this host after removing a source altinstall build, verification looked like:
$ command -v python3.14
$ python3 --version
Python 3.13.3
$ which python3
/usr/bin/python3(python3.14 produces no path; system python3 still reports the Ubuntu release default—3.10 on 22.04, 3.12 on 24.04, or your version on newer releases.)
Python 3.15 (pre-release)
Same flow with 3.15 package names:
dpkg -l 'python3.15*' | grep ^ii
sudo apt remove --purge python3.15 python3.15-venv python3.15-dev
sudo apt autoremove --purge
command -v python3.15
python3 --versionOptional: remove the Deadsnakes PPA
Only if you uninstalled all Deadsnakes Python versions and will not install another from that archive:
sudo add-apt-repository --remove ppa:deadsnakes/ppa
sudo apt updateSkip this if you still rely on the PPA for another Python line.
Remove Python installed with source altinstall
Use this when which python3.14 (or python3.15) is under /usr/local/bin after make altinstall.
List versioned files first:
ls /usr/local/bin/python3.14 /usr/local/bin/pip3.14 2>/dev/null
ls -d /usr/local/lib/python3.14 /usr/local/include/python3.14 2>/dev/nullRemove binaries and libraries for that version only (example for 3.14):
sudo rm -f /usr/local/bin/python3.14 /usr/local/bin/pip3.14 \
/usr/local/bin/pydoc3.14 /usr/local/bin/idle3.14 /usr/local/bin/python3.14-config
sudo rm -rf /usr/local/lib/python3.14 /usr/local/include/python3.14
sudo rm -f /usr/local/share/man/man1/python3.14.1
sudo rm -f /usr/local/lib/libpython3.14.a /usr/local/lib/pkgconfig/python-3.14*.pcFor 3.15, substitute 3.15 in every path.
Verify:
command -v python3.14
python3 --version
hash -rRun hash -r or open a new shell so your session drops cached paths to deleted binaries.
Do not run sudo rm -rf /usr/local/bin/python3 unless you are certain you never created an unversioned python3 symlink from a manual make install.
Remove a Python version managed by pyenv
If the interpreter lives under ~/.pyenv:
pyenv versions
pyenv uninstall 3.14.6Remove .python-version in project directories that still pin the deleted release. Other pyenv versions and system python3 are unaffected.
To remove pyenv entirely (uncommon):
rm -rf ~/.pyenvThen delete pyenv init lines from ~/.bashrc or ~/.zshrc.
Remove a virtual environment (not the Python interpreter)
A venv is a directory (often under ~/venvs/). Deleting it does not uninstall python3.14 or python3.15 from the system.
Deactivate if the venv is active, then delete:
deactivate 2>/dev/null || true
rm -rf ~/venvs/myprojectUpdate IDE interpreter settings, systemd units, cron jobs, or CI configs that pointed at that path.
Verify removal and system health
After any method above, run:
python3 --version
which python3
sudo apt update
sudo apt-get checkConfirm the version you removed is gone:
command -v python3.14
command -v python3.15Optional: list remaining versioned binaries:
ls /usr/bin/python3.* /usr/local/bin/python3.* 2>/dev/nullSystem python3 should still exist; the removed version should not.
Troubleshooting
apt fails after I removed Python packages
You may have purged system python3 or a dependency apt needs. From a root shell, reinstall Ubuntu’s default stack:
sudo apt update
sudo apt install --reinstall python3 python3-minimalIf apt itself errors before that, use Ubuntu recovery mode or a live ISO chroot.
python3.14 still appears after apt remove
Check for a source install under /usr/local:
type -a python3.14Remove /usr/local files from the altinstall section, or both Deadsnakes and /usr/local if you installed twice.
I only wanted to stop using 3.14 for one project
Delete or recreate the project venv; keep the system-wide python3.14 package if other projects use it.
sudo apt autoremove wants to remove unrelated packages
Read the proposed list before confirming. If essential libraries are marked for removal, cancel and remove only explicit python3.14* package names with apt remove --purge.
Summary
Uninstalling Python on Ubuntu means removing the extra interpreter you added—Deadsnakes packages, /usr/local altinstall files, a pyenv release, or a venv directory—not purging system python3. Match the removal steps to how you installed Python, verify python3 --version and sudo apt update afterward, and optionally drop the Deadsnakes PPA when you no longer need it.

