Install and upgrade Python
If the APT repositories don’t support the old or new version you’re after.
macOS
Note that upgrading Python with Homebrew causes all my virtual envs to break. Using Pyenv is safer.
Install
Using the python@3.9 formula.
Upgrading
I had 3 versions of PY3 installed.
The system default is Python3.7.
And Python 3.8 was known by Brew.
Python 3.9 got installed because sphinx-doc has it as a dependency, but it did not replace the existing one. See notes from the output.
Try this to sort out the linking:
Then you can add this to PATH — /usr/local/opt/python@3 .
Also I can’t just delete the old one as it is used by other Brew packages.
Doing an install of Python 3.9 made it the default without having to update my PATH .
And /usr/local/bin/python3 links to ../Cellar/python@3.9/3.9.0/bin/python3 now.
Dev Cheatsheets
- Michael Currin
A collection of code snippets and CLI guides for quick and easy reference while coding
How to Update Python in Windows, Linux & MacOS
Every year Python launches a new version of itself to provide new and improved services to its users. With every update, Python launches new features and bug fixes. This article shows, How to update Python on different platforms?
A section of the article also shows how to check the current Python version installed in the system.
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.
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
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 in 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.
Now to update Python, enter the below commands in the terminal:
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:
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’s 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.
Get or update Python 3 on your computer
![]()
This is the fastest way to get python on your computer that I know of. And while there are many ways I suggest you use Anaconda. One of the best parts is that Anaconda offers installers for all OSs available. And since Python 2 is going to be killed off around 2020 by Python 3. It is best to get the 3.7 version installed.
1 — Download the installers for Windows, Mac, Linux. Although like anything else dealing with Linux I assume you already know all of this.
2 — Click through all of the default settings by clicking the “Continue” or “Install” buttons. While you can change the install settings on this page you should still select “install for me only” setting.
(I assume you are using YOUR computer, NOT a school or work one)
3 — Restart your computer.
And there you are. You should have python on your computer now. But first, read the next sections to make sure you did it right.
Where is the terminal?
If you are unaware of what the terminal is please follow the instructions from learn python the hard way to find out how to get to your terminal on your computer. No matter what OS it is.
To make sure you have the correct Python version
Go to the terminal (don’t type the ‘$’ sign EVER).
1 — In your terminal type $ python —version
You should get back something like Python 2.7.5
2 — If you get back version 2.whatever check for version 3
In your terminal type $ python3 —version
You should get back Python 3.7.0
If you got 3.7. whatever, YAY you did it.
UPDATE python 3
Use the Terminal for the following steps.
If you are in an environment with Python version 3. whatever, the following command updates Python to the latest version in the 3.whatever branch:
(bear in mind that it will take some time)
❌ But if that returns something like:
OR … (if the above fails the next command will do it)
✅ Now that you have done that you should finally see the following.
CONGRATS you finished the UPGRADE!
And you did not upgrade to the newest available anaconda 3 then try the next step.
The NEWEST Python 3 is 3.8 HOWEVER …
The installer is only up to 3.7 at the time of this writing. But that is OK for now don’t worry about it.
Congrats reader!
I hope that this short article helped you.
Welcome to a new world of possibilities.
How to update Python on Windows?
In this article, we are going to see how to update Python in the Windows system. For the sake of example, we will be upgrading from Python 3.6.8 to Python 3.9.6.
To check the current version of python on your system, use the following command in the command prompt:
This will show you your current python version as shown below:
Using the executable installer:
Follow the below steps to update your python version:
Step 2: Click on the Downloads tab.
Here you will get a list of available releases.
Step 3: Download the version you need to upgrade to based on your system specifications(ie, 32-bit or 64-bit). Here we will be downloading the 64-bit installer for 3.9.6.
Step 4: Click on the installer and it will begin the installation. Make sure to select the “Add Python 3.9 to PATH” option. and click on “Install Now”.
This will start the installation as shown below:
After the installation is successful you will get the following message:
Now if you open up your cmd and use the below command:
You’ll see your version of Python has been updated to 3.9.6 as shown below: