Every fresh Python release comes with bug fixes and new features. Python 3.12, the latest point release when this article was written, comes with features such as flexible f-string parsing, support for the buffer protocol, a new debugging/profiling API, and many performance improvements.
This tutorial shows you how to update Python to the latest version on all the major operating systems - Windows, macOS, and Linux.
- Administrative rights on the operating system you are using.
- Knowledge of which Python version is currently on your system (refer to our guide on How to Check Python Version for instructions).
Update Python on Windows
via Python Installer
The Python installer is available on the official Python website. Follow the steps below to install it:
2. Scroll down to the Files section and select the 32-bit or 64-bit installer, depending on your architecture. In this tutorial, we will use 64-bit.
3. Next, run the Python installer. Select Install Now to install Python with the recommended options, or select Customize Installation to pick the install location and features. Check the Add python.exe to PATH checkbox to run Python scripts and access Python packages from any directory using the command prompt.
4. When the installation finishes, check whether the new Python version has been installed successfully. Open Windows PowerShell and type:
The output should show the latest version of Python, as in the image below.
Chocolatey is a command-line package manager for Windows. Follow the steps below to update Python using Chocolatey:
1. Open the Windows PowerShell or Command Prompt and run the following command:
choco find python
The command outputs all the packages containing the keyword Python. You can install any package from the list. In this tutorial, we will install the latest version.
2. Run the following command to update your Python app:
choco install python
To install a different version, specify the version number in the package name.
via Microsoft Store
If you want to use the latest Python version to learn the basics or test some simple concepts, find and install the Python app from the Microsoft Store.
1. Open the Microsoft Store and type Python in the search field. Select the latest Python version from the search results that appear. In our case, it is Python 3.12:
2. Click the Get button to start the installation and wait for the process to complete.
3. Start the interactive Python experience by finding the app in the Start Menu.
Update Python on Linux
There are two ways to update Python on Linux Ubuntu: by installing the latest version available in the deadsnakes PPA or by compiling it from the source code.
Warning: Many Linux systems have Python 2 installed as the system version. Removing Python 2 could cause a system error. If you are planning to install Python 3 on Linux, install it alongside Python 2 and invoke it with the
The latest Python versions are available in the deadsnakes PPA. Follow the steps below to add the PPA to your system and update Python:
1. Add the PPA to your system by running the command below:
sudo add-apt-repository ppa:deadsnakes/ppa
The command adds the PPA to your system and lists the available Python versions for your system. At the time this article was written, the latest version in the repository was Python 3.13, which is a pre-release version.
2. Install the latest Python version by running the command below:
sudo apt install python3.13
When prompted, type y and press Enter to continue the installation. The latest available version for our system is Python 3.13. You can specify any of the available versions to install that one.
3. Check the program version after installation by running:
The command outputs the installed Python version.
4. Next, install PIP for Python on Ubuntu by running:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13
Make sure to replace the Python version in the command with the one you installed.
via Source Code
If the PPA doesn't have the Python version you need, you can install it by compiling it from the source code. Follow the steps below:
1. Install the build libraries required for compiling Python from source code. Run the following command:
sudo apt install build-essential checkinstall \ libreadline-gplv2-dev libncursesw5-dev libssl-dev \ libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
2. Navigate to the /usr/src directory and download the Python source code using the wget command. Check the official Python source code page to ensure you compile the latest version. Run the commands below and replace the version numbers in the link with your own:
cd /usr/src sudo wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
3. After the download finishes, extract the archive using the command below:
sudo tar xzf Python-3.12.0.tgz
Replace the version number in the command with the one you have downloaded.
4. Change the working directory to the one with the extracted source code and prepare it for compiling using the commands below:
cd Python-3.12.0 sudo ./configure --enable-optimizations
5. Compile the source code by running the following command:
sudo make altinstall
The process takes some time to complete. Wait until it finishes to start using the latest Python version.
Update Python on macOS
via Python Installer
1. In your browser, navigate to the Python Releases for macOS page. Click the Latest Python 3 Release link to go to the installer downloads page.
2. Scroll to the Files section and select the macOS universal installer to start the download.
3. Run the downloaded installer and go through the installation steps. Click Continue, agree to the License, and confirm the installation location and type.
4. Once the installation is complete, select Close.
5. Finally, confirm that the new Python version has been successfully installed by running the following command in the terminal:
The output displays the latest Python version installed on your system.
Install Python in the macOS terminal using the Homebrew package manager. If you do not have it installed already, install Homebrew on Mac by typing the following script in the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then, proceed with the steps:
1. Update Homebrew by running:
2. If you are upgrading from Python 2, install Python 3 with the command:
brew install python3
If you already have a version of Python 3 installed, upgrade the package with the
brew upgrade command:
brew upgrade python3
Why Should You Update Python?
Since Python 3 was not a backward-compatible release, Python 2 has remained the version of choice for a long time for those who wanted a stable development environment. Some services, like Google App Engine, did not initially support Python 3.
However, given that the official support for the final Python 2.7 release has ended upgrading to Python 3 is now strongly recommended. Python 3 is faster, and its syntax is more user-friendly.
If you already work with Python 3, upgrading to the latest point release gives you all the security updates, bug fixes, and new features.
After reading this tutorial, you should know how to update your Python 3 version on Windows, macOS, and Linux.
To learn more about Python, read our article on Python data types.