In this article, we will explore how to update Python in Linux, Windows, and macOS
Check your Python version:
Before updating Python, one should check if one already has the latest version of Python in the system. Let us now follow the steps provided in the subsequent section for fetching the Python version.
For Windows
Open the command prompt to check the Python version installed:
- Click the Windows key and search cmd.
- Open the command prompt, type python, and hit enter.
Its version number shall appear after the phrase Python.
For MAC
Python comes pre-installed in the MAC operating system. If your computer has an old Python version, programmers can update it to the latest one following the process given here.
For checking the Python version present in the system:
- Open the application folder -> Utilities folder -> open the terminal.
- Once you open the terminal window, type the given command, and click the return key to confirm the version of Python.
python --version
The above command shall show the Python’s version number that is installed in your computer.
For Linux
Python comes pre-installed in the Linux operating system. Before updating, it is crucial to check the Python version installed in the system.
To check the Python version present in the system:
- Open the terminal window in Linux by simply clicking Ctrl + Alt + T
- Type the below command and hit the return key
python --version
This command will display the current Python version number installed in the system.
Updating the Python for various platforms (MAC, Windows, and Linux)
One can update Python by going to its official site and then downloading the latest version of Python available. One can also use the terminal or command prompt of the operating system to update Python.
Update Python on Windows
Updating Python is easy for Windows users.
- Go to the website of Python, and click on the Python download button
- After clicking the Python download button, downloading of the installation file shall begin
- Now run the installer, the installer will automatically suggest downloading the latest version of Python
- And, if the system has an old Python version, the installer will display an upgrade now button. Click the button to start the upgrading process.
Update Python in MAC Systems
One can update Python for MAC from Python's official website. One can also update Python in MAC using Homebrew. You have to follow the steps provided in the subsequent section to update Python with Homebrew:
First, one needs to have the Homebrew package manager in his system. To do that, one must download Homebrew from the Homebrew site. One can also download Homebrew by copying the below code into the terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now to update Python, enter the below commands in the terminal:
brew upgrade python3 #(old Python version number)
Update Python in Linux Systems
If the system doesn't have the latest version of Python, one can update the Python by copying the below commands to the terminal:
sudo apt update
sudo apt install software-properties-common
The above command will install all the essential packages required to install the latest version of Python.
Conclusion:
Every year Python launches a new version to provide new and improved services to its users. This article is about installing the latest and updated Python version.
One can follow the above steps to check if Python's latest version is already present in the system. Knowing that will surely save a lot of time and effort.