How — To Update Python
Instead, install the new version alongside the old one. sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.12 # Replace 3.12 with the latest version Method B: Using pyenv (Best for Developers) pyenv lets you switch versions instantly per project.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew update brew upgrade python Step 3: Link the new version If you have multiple versions, force the link:
python --version Windows allows side-by-side versions. To run the old version later, use py -3.9 instead of python . How to Update Python on macOS MacOS ships with an ancient, system-dependent version of Python 2.7 (or 3.6 on older OSes). Do not touch the system Python. Instead, use Homebrew. Step 1: Install Homebrew (if you haven't) Open Terminal and paste: how to update python
Pip is tied to a specific Python version. After an upgrade, reinstall your tools.
Here is exactly how to update Python on Windows, macOS, and Linux without pulling your hair out. Do not just update your system Python and hope for the best. If you do, libraries installed via pip for your old version might vanish, and legacy scripts will crash. Instead, install the new version alongside the old one
The Ultimate Guide to Updating Python: Stay Safe, Stay Current Meta Description: Confused about upgrading Python? Whether you use Windows, macOS, or Linux, this step-by-step guide shows you how to update Python without breaking your existing projects. Python is evolving faster than ever. With new features arriving every 12 months (and security patches every few weeks), staying on the latest version isn't just about having the coolest syntax—it’s about safety and performance.
source venv/bin/activate # or venv\Scripts\activate on Windows pip install -r requirements.txt Q: I updated Python, but my IDE (VS Code/PyCharm) still shows the old version. A: You need to manually change the Python interpreter in your IDE settings. Point it to the new executable path. To run the old version later, use py -3
export PATH="/usr/local/opt/python/libexec/bin:$PATH" WARNING: Never uninstall the default python3 package on Linux. The OS uses it for critical tools (like apt ). You will crash your system.