How to Update Python
What you’ll build or solve
You’ll update Python to a newer version on your computer and confirm your terminal is using it.
When this approach works best
This approach works best when you:
Learn Python on Mimo
- Need features or fixes from a newer Python release for a course, library, or tool.
- Hit install errors because a package requires a newer minimum Python version.
- Want your system and editor to stop using an older Python that keeps showing up in the terminal.
Avoid this approach when:
- You’re on a work-managed machine where updates require IT approval.
- You have a production server without a planned upgrade and deployment process.
Prerequisites
- A terminal: Command Prompt, PowerShell, or Windows Terminal on Windows, Terminal on macOS, any shell on Linux
- Permission to install software on your machine
Step-by-step instructions
1) Check what Python you’re using now
Start by checking both the version and the path. This helps you spot multiple installs, which is the main reason updates “don’t work.”
Bash
python --version
python -c "import sys; print(sys.executable)"
On many macOS and Linux systems, python might not exist, so try:
Bash
python3 --version
python3 -c "import sys; print(sys.executable)"
What to look for: the sys.executable path. If it points to something you did not expect (Microsoft Store, Anaconda, Homebrew, pyenv), update that installation method instead of adding a second one. Mixing methods often leads to PATH conflicts where the old version keeps winning.
2) Update on Windows
Option A (most common): Use winget
Check that winget works:
Bash
winget --version
Install the newest Python version winget offers. Each minor version has its own winget ID (for example Python.Python.3.14), so pick the newest one from the search results:
Bash
winget search Python.Python.3
winget install --id Python.Python.3.14 -e
To get the latest patch release winget offers for a version you already have, upgrade its exact ID from winget list python. This stays within that minor version, for example 3.12.x:
Bash
winget list python
winget upgrade --id Python.Python.3.12 -e
Close and reopen your terminal so PATH updates apply, then verify:
Bash
python --version
py -V
py -c "import sys; print(sys.executable)"
What to look for: py comes from the Python install manager or the older Python Launcher. It often points at the newest Python even when python still points at an older one.
Option B (alternative): Use the Python install manager
Download the Python install manager from python.org, run it, and select Install. In a new PowerShell window, install or update to the newest Python:
pymanager install --update default
To update all runtimes the install manager installed, run pymanager install --update. If where.exe python shows an older standalone Python first, uninstall it (and Python Launcher, if listed) in Installed apps, or use Modify to turn off its PATH option. If you use the standalone installer instead, select Add python.exe to PATH during setup.
Verify in a fresh terminal:
Bash
python --version
where.exe python
py -c "import sys; print(sys.executable)"
What to look for: where.exe python can list multiple entries. The first path is usually what runs when you type python.
3) Update on macOS
Option A (most common): Use Homebrew
Bash
brew update
brew upgrade python
Verify:
Bash
python3 --version
which python3
python3 -c "import sys; print(sys.executable)"
What to look for: which python3 often shows a Homebrew path like /opt/homebrew/bin/python3 (Apple Silicon) or /usr/local/bin/python3 (Intel).
Option B (alternative): Use the official installer
Install Python from python.org, then verify:
Bash
python3 --version
which python3
python3 -c "import sys; print(sys.executable)"
If the terminal still uses an older version, another install (like Homebrew or pyenv) is probably earlier in your PATH.
4) Update on Linux
Linux updates depend on your distro. Many distros ship stable versions that can lag behind the newest release.
Option A (most common): Use your package manager
Ubuntu/Debian example:
Bash
sudo apt update
sudo apt install python3 python3-venv
python3 --version
python3 -c "import sys; print(sys.executable)"
If you need a specific newer version and your repos do not provide it, use pyenv.
Option B (alternative): Use pyenv for newer versions
After installing pyenv for your distro, install and select a version:
Bash
pyenv install 3.15
pyenv global 3.15
python --version
python -c "import sys; print(sys.executable)"
If pyenv says 3.15 isn’t a known version, update pyenv first: brew upgrade pyenv (Homebrew), git -C "$(pyenv root)" pull (git install), or pyenv update (pyenv.run installer).
What to look for: pyenv versions shows what’s installed, and pyenv which python shows which executable you’re running.
5) Recreate virtual environments for the new Python version
Updating Python does not update the packages inside your existing virtual environments. A venv is tied to the Python that created it, so the clean path is to recreate it.
Recreate the venv. --clear deletes everything in the old .venv, so if you don't have a requirements.txt yet, run python -m pip freeze > requirements.txt inside the old venv first. Then open a new terminal (or run deactivate) and check that python --version shows the new version. On macOS/Linux, use python3 instead of python.
Bash
# macOS/Linux
python3 -m venv --clear .venv
# Windows PowerShell
python -m venv --clear .venv
Activate it:
Bash
# macOS/Linux
source .venv/bin/activate
# Windows PowerShell
.\.venv\Scripts\Activate.ps1
Upgrade pip inside the venv:
Bash
python -m pip install --upgrade pip
Reinstall your dependencies:
Bash
python -m pip install -r requirements.txt
What to look for: if you keep an older .venv, you may see import errors or binary wheel issues after the Python update, even though the system Python looks correct.
6) Confirm the update worked
Run these checks in a new terminal window:
Bash
python --version
python -c "import sys; print(sys.version); print(sys.executable)"
If you rely on python3 instead of python, run the same checks with python3.
Examples you can copy
Example 1: Windows update with winget, then confirm what runs
Bash
winget list python
winget upgrade --id Python.Python.3.12 -e
python --version
where.exe python
py -c "import sys; print(sys.executable)"
Replace Python.Python.3.12 with the ID from winget list python. Use this to apply patch updates to the version you have, then confirm which Python runs. If python --version and py -V disagree, PATH order needs attention.
Example 2: macOS Homebrew update and PATH confirmation
Bash
brew update
brew upgrade python
python3 --version
which python3
python3 -c "import sys; print(sys.executable)"
Use this when you want the Homebrew-managed Python for development.
Example 3: Linux with pyenv for a specific version, plus a fresh venv
Bash
deactivate 2>/dev/null # leave any active venv first
pyenv install 3.15
pyenv global 3.15
python --version
python -m venv --clear .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Use this when your distro packages are older than what your project needs.
Common mistakes and how to fix them
Mistake 1: Updating Python, but the terminal still shows the old version
What you might do: update Python, then run python --version and still see the older version.
Why it breaks: your shell is finding a different Python earlier in PATH.
Fix: find which Python is being used, then remove the conflict.
Windows:
Bash
where.exe python
py -V
macOS/Linux:
Bash
which python
which python3
Then uninstall the Python you do not want, or adjust PATH so the intended one appears first. On Linux, don’t remove the distro’s python3 (for example with sudo apt remove python3), because system tools depend on it. Adjust PATH or use pyenv instead.
Mistake 2: Keeping an old virtual environment after updating Python
What you might do: update Python, then keep using an existing .venv.
Why it breaks: the venv references an older interpreter and can include packages built for that older version.
Fix: recreate the venv and reinstall dependencies.
Bash
# delete the old .venv folder, then:
# macOS/Linux
python3 -m venv .venv
# Windows PowerShell
python -m venv .venv
# activate it, then:
python -m pip install -r requirements.txt
Troubleshooting
- If you see
python: command not found, usepython3 --versioninstead. Many systems only providepython3. - If you see multiple results from
where.exe python(Windows), the first path usually wins. Remove the extra Python install, or fix PATH order so the one you want comes first. - If you see
Permission deniedorexternally-managed-environmentwhen installing packages, install inside a virtual environment, not globally. - If pip installs to the wrong Python, always run pip through Python:
Bash
python -m pip install <package>
- If your editor runs a different Python than your terminal, print the executable path in both places and select the same interpreter in your editor:
Bash
python -c "import sys; print(sys.executable)"
python3 -c "import sys; print(sys.executable)"
Quick recap
- Check your current version and the executable path.
- Update Python using one method that matches your setup.
- Verify the new version in a fresh terminal.
- Recreate your virtual environments, upgrade pip inside them, and reinstall dependencies.
- If something still looks off, check PATH and confirm which executable is running.
Join 40M+ people learning for free on Mimo
4.8 out of 5 across 1M+ reviews
Check us out on Apple AppStore, Google Play Store, and Trustpilot