Update/Upgrade Python in Windows, Linux & MacOS
The process for updating your version of Python depends on the operating system you are using. Following are the general steps for updating Python on different platforms (Windows, Linux & MacOS):Update/Upgrade Python in Windows
To update Python in Windows, you can follow these steps:Check your current version of Python:
Open a Command Prompt or Terminal window and type:
python --version
This will give you the version of Python that is currently installed on your system.
Download the latest version of Python:
Visit the official Python website ( python.org ) and download the latest version of Python for Windows.Install the new version of Python:

Run the Python installer and follow the instructions to install the new version of Python.
Update your PATH environment variable:
The PATH environment variable should be updated to include the path to the new version of Python. To do this:- Go to the System Properties
- Click on the "Environment Variables" button
- Scroll down to the "System variables" section
- Find the "Path" variable, click "Edit"
- Add the path to the new version of Python to the list of paths
Verify the installation:
Open a Command Prompt or Terminal window and type
python --version
You should see the updated version of Python displayed.
Note: If you have multiple versions of Python installed on your system, you may need to specify the path to the new version of Python in order to use it. You can do this by running the Python executable with the full path to the executable, such as "C:\PythonXX\python.exe", where XX is the version number.
Update/Upgrade Python in linux
To update Python in Linux, you have several options, depending on the distribution you are using. Here are the steps for updating Python on some common Linux distributions:Debian/Ubuntu:
You can use the apt-get package manager to update Python. First, run the following command to update your package index:
sudo apt-get update
Then, run the following command to upgrade Python to the latest version:
sudo apt-get upgrade python3
Fedora:
You can use the dnf package manager to update Python. First, run the following command to update your package index:
sudo dnf update
Then, run the following command to upgrade Python to the latest version:
CentOS/RHEL:
You can use the yum package manager to update Python. First, run the following command to update your package index:
sudo yum update
Then, run the following command to upgrade Python to the latest version:
sudo yum upgrade python3
Arch Linux:
You can use the pacman package manager to update Python. First, run the following command to update your package index:
sudo pacman -Syu
Then, run the following command to upgrade Python to the latest version:
sudo pacman -S python
Note: After updating Python, you may need to adjust the paths in your shell configuration file, such as .bashrc or .zshrc, to point to the new version of Python.
Update/Upgrade Python in macOS
To update Python in macOS, you have several options, depending on how you originally installed Python. Here are the steps for updating Python using some common methods:Using Homebrew:
If you installed Python using Homebrew, you can use the following command to update Python:
brew upgrade python
Using the Python.org Installer:
If you installed Python using the Python.org Installer, you can download the latest version of Python from the official Python website ( python.org ) and install it over your existing installation.Using the macOS built-in Python:
If you are using the built-in version of Python that comes with macOS, it is not recommended to upgrade or replace this version as it may cause compatibility issues with other system components that depend on the built-in Python. If you need to use a newer version of Python, it is recommended to install it using a different method, such as using Homebrew or the Python.org Installer, and use a virtual environment or a separate version manager to manage the multiple versions of Python on your system.
Related Topics