Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest way to use a different Python version on Ubuntu is to leave the system python3 unchanged and select the version inside a virtual environment. Install the interpreter you need, create a project environment with that interpreter, activate it, and verify that the shell is using the project’s executable. This avoids breaking Ubuntu tools that depend on the distribution-managed Python.

If you only want the python command to mean Python 3, install Ubuntu’s python-is-python3 package. If several projects require different versions, use separate virtual environments or a version manager such as pyenv. Repointing /usr/bin/python3 is a system-wide administrative change and should not be your normal development workflow.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What “default Python version” can mean on Ubuntu

The phrase can describe three different settings. Choosing the right one prevents you from changing more of the operating system than necessary.

Project default

A virtual environment gives one project its own interpreter and packages. Once .venv is activated, python, python3, and pip resolve to that environment. This is the recommended choice for applications, scripts, data work, and reproducible development.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

User shell default

A shell alias, a PATH entry, pyenv, or an activated virtual environment changes what one user runs when typing a command. Ubuntu’s managed files remain intact. This is useful when you want a convenient command in your own account, but it does not change how system services or other users invoke Python.

System default

The distribution’s /usr/bin/python3 is managed by Ubuntu. It is a symbolic link to the release’s current default Python 3 interpreter. Distribution scripts and packages may depend on that arrangement, so replacing the link can make upgrades, package tools, or desktop components fail. Treat a system-wide change as an exceptional administrative operation with a tested rollback plan.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

First identify your Ubuntu release and installed interpreters

Python package names and the default version vary by Ubuntu release. A command that works on 22.04 may not select the right interpreter on 24.04 or a later release. Record the release before choosing a version-specific command.

lsb_release -a

If lsb_release is not installed, use:

cat /etc/os-release

List the Python executables already available in your PATH:

command -v python3
python3 --version
ls -1 /usr/bin/python3*

Ubuntu publishes a release-by-release table of available Python 3 packages and the python3-defaults version. Use that table, or your release’s package search, to confirm that a version such as python3.11 or python3.12 exists before putting it in a command.

Recommended method: choose a Python version for one project

The following example uses Python 3.12. Substitute the versioned executable that is actually installed on your release. Do not copy python3.12 if your system only provides python3.10 or python3.11.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Install the environment support packages

Ubuntu’s standard packages provide the virtual-environment module and a fuller Python installation:

sudo apt update
sudo apt install python3-venv python3-full

If the required version is not installed, install that version from packages available for your Ubuntu release, then confirm its executable name:

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
command -v python3.12
python3.12 --version

When command -v prints nothing, the interpreter is not available under that name. Check the release’s package list rather than creating a link by hand to an unrelated binary.

2. Create the virtual environment with the intended interpreter

From the project directory, run the versioned interpreter with the -m venv module:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cd ~/path/to/project
python3.12 -m venv .venv

The directory name .venv is conventional; you can choose another name, but keep it inside the project if that makes activation and discovery clearer. The environment records which interpreter created it, so create a new environment when changing the project’s Python version.

3. Activate it in your shell

source .venv/bin/activate

Your prompt commonly gains a (.venv) prefix. Activation prepends the environment’s bin directory to PATH; it does not modify Ubuntu’s system interpreter.

4. Verify both the version and the executable path

which python3
python3 --version
python --version
python -m pip --version

The which python3 result should point into the project, for example /home/you/project/.venv/bin/python3. The reported Python version should match the interpreter used to create the environment. Using python -m pip ties pip to the same interpreter and avoids accidentally installing into another Python.

5. Install dependencies and leave the environment when finished

python -m pip install -r requirements.txt
deactivate

After deactivate, your shell returns to its previous PATH. Re-entering the project later requires running source .venv/bin/activate again. Keep the environment out of version control by adding .venv/ to the project’s ignore file; record dependencies in a requirements file or the project’s chosen packaging metadata instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make python invoke Python 3

Some Ubuntu installations provide python3 but no unversioned python command. If your only requirement is that python invoke Ubuntu’s Python 3, install the distribution package designed for that purpose:

sudo apt update
sudo apt install python-is-python3

This supplies a /usr/bin/python link to /usr/bin/python3. It does not select an arbitrary newer interpreter, and it does not replace the release’s default python3. Inside an active virtual environment, the python command should instead resolve to that environment’s interpreter, as recommended by PEP 394.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

A shell-only alternative is an alias in your interactive shell configuration:

alias python=python3

An alias affects interactive commands in shells that read that configuration; scripts, login shells, services, and other users may not see it. For scripts, prefer an explicit shebang or invoke the intended interpreter rather than relying on a personal alias.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use different Python versions with pyenv

When several projects need different interpreters, pyenv can select a version without interfering with Ubuntu’s system Python. Its selections are user-level shims, not replacements for /usr/bin/python3.

Configure both interactive and login shells

Follow pyenv’s current installation instructions for your shell, then place the required initialization in both ~/.bashrc and ~/.profile. The Ubuntu developer guidance specifically calls for both files so that interactive terminals and login sessions see the same selection. Open a new terminal, or reload the files, after changing them.

Install and select a version

After pyenv is available, the usual workflow is:

pyenv install --list
pyenv install 3.12.x
pyenv global 3.12.x
python --version

Replace 3.12.x with an exact version offered by pyenv install --list. Use a project-local selection when one directory needs a different interpreter:

cd ~/path/to/project
pyenv local 3.11.x
python --version

A local selection writes a project configuration file and takes precedence when you work in that directory. You can still create a virtual environment from the selected interpreter for package isolation. If a shell reports the wrong executable, inspect the shim and PATH:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
command -v python
pyenv which python
pyenv version

Why changing /usr/bin/python3 is risky

Ubuntu’s documentation warns not to remove the default system installation of Python, because system tooling depends on the python3 package. Package managers, release utilities, and desktop components may assume the libraries and ABI supplied by the Ubuntu release.

The /usr/bin/python3 link is intentionally controlled by the distribution. Manually deleting it, replacing it, or pointing it at a locally compiled binary can produce failures that are difficult to diagnose: a script may import a module from the wrong release, an upgrade may overwrite your change, or an Ubuntu tool may stop starting. Installing another interpreter alongside the default is safe; changing the managed link is a different class of operation.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Where update-alternatives fits

update-alternatives is a generic mechanism for maintaining symbolic links that choose a default command. Community instructions sometimes register several Python binaries as alternatives and then select one. The mechanism itself is real, but a recipe that is harmless on one Ubuntu release can conflict with another release’s package ownership, scripts, or maintenance expectations.

Do not use an untested alternatives command as the first solution to a project-version problem. Prefer, in order:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • A virtual environment created with the required version.
  • A pyenv local or global selection for user-level version management.
  • An explicit command such as python3.12 in a controlled script or build step.
  • A shell-level setting when only your interactive workflow needs changing.

If an administrator has a specific legacy requirement for a machine-wide command, document the current link target, register only binaries supported by that Ubuntu release, test package and service operations, and record how to restore the distribution-managed target. Never remove the packaged python3 installation to make an alternative work.

Fix the “externally managed environment” pip error

Ubuntu may prevent pip from writing into the system installation and display an externally-managed-environment error. This protection exists because apt owns the system Python packages; mixing arbitrary pip files into that location can leave the package database and imports inconsistent.

Install a module from Ubuntu packages

If the module is packaged for your release and is intended to be shared by system tools, install the corresponding Debian/Ubuntu package with apt. Package names commonly use a python3- prefix, but confirm the exact package for your release.

Install application dependencies in a virtual environment

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install package-name

Because pip now runs through the environment’s interpreter, it does not modify the apt-managed system installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install an isolated command-line application with pipx

For Python applications that you run as commands rather than import into a project, pipx creates an isolated environment for each application. Install and configure pipx using the packages and instructions available for your Ubuntu release, then install the application through pipx. This keeps its dependencies separate from both the system interpreter and your project environments.

Why --break-system-packages is not the normal fix

pip offers a --break-system-packages override, but it deliberately bypasses Ubuntu’s protection. Use it only when you understand the ownership and recovery consequences for that machine. It is not a substitute for a virtual environment, apt package, or pipx-managed application.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Compare the available approaches

Approach Changes Ubuntu system files? Scope Multiple versions Package isolation Rollback difficulty Compatibility with apt-managed tooling
Virtual environment (venv) No One project Yes, one environment per version Strong Easy: remove and recreate .venv High
pyenv No system replacement; user shims and installed user versions One user, with project-local or global selections Yes Requires a venv for full dependency isolation Easy at user level High, provided system Python remains intact
python-is-python3 Adds the distribution’s /usr/bin/python link Whole machine’s unversioned command No version management None Easy through apt Designed for Ubuntu’s Python 3 mapping
Shell alias or PATH setting No One user and selected shells Only as configured None Easy: remove the setting Does not affect system services
update-alternatives for Python Changes managed command links Potentially whole machine Yes, if registered correctly None Requires careful link and package restoration Release-dependent risk
Manual replacement of /usr/bin/python3 Yes Whole machine Not safely None Difficult if system tools fail Low; avoid

Verification checklist for any change

Run these commands before and after changing your workflow. They reveal the version, the command found by PATH, and the real file behind a symlink:

python3 --version
command -v python3
readlink -f "$(command -v python3)"
python --version 2>/dev/null || true

Inside a virtual environment, also verify:

which python3
python3 --version
python -c 'import sys; print(sys.executable)'
python -m pip --version

The executable paths should be under your project directory when the environment is active. If python -m pip --version shows a system path while your prompt says (.venv), activation or PATH ordering is wrong; use the environment’s absolute executable while you correct the shell configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common symptoms

python3.12: command not found

The requested version is not installed under that name or is not on PATH. Check the Ubuntu release, inspect available packages, and use the versioned command that actually exists. Do not create a symbolic link from python3.12 to a different interpreter merely to satisfy a script.

ensurepip or venv is missing

Install python3-venv and, when appropriate, python3-full with apt. Re-run the environment creation command using the intended version.

Activation appears to work, but the old version remains

Check command -v python3 and python -c 'import sys; print(sys.executable)'. A shell function, alias, or PATH entry may be taking precedence. Run deactivate, open a fresh shell, and activate the environment again. With pyenv, inspect pyenv version and pyenv which python.

pip still reports an externally managed environment

Confirm that the environment is active and invoke pip through its interpreter: python -m pip install package-name. If the command still resolves to /usr/bin/python or /usr/bin/python3, fix activation before installing anything. For a system-wide module, use apt; for a standalone Python application, use pipx.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ubuntu tools fail after a system-wide Python change

Stop making further link changes. Record the output of lsb_release -a or /etc/os-release, inspect where python3 resolves, and restore the release’s packaged interpreter using Ubuntu’s documented recovery procedure. Reinstalling or repairing packages may be necessary. Future project requirements should be moved into virtual environments or pyenv rather than the system path.

Practical decision guide

  • One application needs Python 3.11 or 3.12: install that interpreter, create .venv with its versioned executable, and activate it.
  • You need python to mean Ubuntu’s Python 3: install python-is-python3, or use a shell alias for an interactive-only preference.
  • Several projects need different Python releases: use pyenv selections and create a virtual environment for each project.
  • pip is blocked by an externally managed environment: choose apt, a venv, or pipx according to whether the dependency is a system module, project dependency, or standalone application.
  • You are considering changing /usr/bin/python3: do not do so for ordinary development; preserve Ubuntu’s default and isolate your required version instead.

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.