Welcome to this quick and easy tutorial on How to Install Python on Windows, MacOS and Linux.
In order to use Python, we naturally need to install it first. There are various ways to accomplish this based on what OS (Operating System) you are using and what your purpose for it. Python can be installed on Linux, Windows and MacOS.
We are going to start by first checking if you already have Python installed on your Operating System (OS), and if so, what version you are running.
If you don’t have it installed, (or you have an outdated version), then we are going to download and install the latest version of Python.
Python is also available for other platforms such as AIX, IBM i, iOS, that can be found on their download page. These are however there for very specific use cases, so we won’t cover them in this tutorial.Check if you already have Python Installed
Some Windows, Linux and most MacOS operating systems already have Python installed, so before we install Python let’s check if it is already there, and if so what version.
Check if you have Python installed on a Windows PC
- Click your Windows Start button
- Search “CMD” which is the Windows Command Line (cmd.exe)
- Type: “python –version”
python --version
If it doesn’t return a Python version number like “3.10.5”, then you don’t have it installed.
If however you do have a version of Python installed, it will output the version number.
Check if you have Python installed on a MacOS PC
- Open the MacOS Terminal by pressing “Command+Space” keys to search for the “Terminal”
- Type: “python –version”
If it doesn’t return a python version number like “3.10.5”, then you don’t have it installed.
You might have Python 2 installed on MacOS by default, which we don’t want, as we want to use Python 3. You don’t have to uninstall Python 2, but you can if you want to.
python --version
#If Python was found it will say
#>> python 3.10.5
#If Python was not found it will say
#>> Python was not found
Check if you have Python installed on a Linux PC
- Open the Linux Command Line Terminal by pressing “CTRL+ALT+T” keys
- Type: “python –version”
If it doesn’t return a Python version number like “3.10.5”, then you don’t have it installed.
python --version
#If Python was found it will say
#>> python 3.10.5
#If Python was not found it will say
#>> Python was not found
If you do not have Python 3 installed on your computer, then proceed to the next section below, on How to install Python.
How to Install Python
To install Python, you need to visit the official Python website links listed below, in order to download the latest version for either Windows, MacOS or Linux.
Once downloaded, run the Python file to install it, which will differ slightly, depending on which OS you are using as follows:
How to Install Python on Windows
To install Python on Windows, simply visit https://www.python.org/downloads/ to download the latest 64-bit version for Windows.
- Double click to run the python-3.x.x-amd64.exe
- If this is your first time installing Python, you can enable Add Python to PATH, which simply links it to your Windows CMD command line, making it a priority when you type in “Python”.
- Select Custom Installation
- You can leave the default Documentation, PIP, TCL/TK, Python Test Suit selected.
- Also select to enable “py Launcher”
- Click Next
- Select “Associate Files with Python” and “Add Python to Environment Variables”
- Select a “Destination Folder” or use the default one
- Click “Install” to finish the installation
- You can now launch “Python 3.x.x (64-bit).exe” and start writing some Python code
How to Install Python on MacOS
To install Python on MacOS, simply visit https://www.python.org/downloads/mac-osx/ to download the latest version for your MacOS.
- Double click to run the “python-3.x.x-macosxX.x.pkg“
- Click “Continue” and “Agree“
- Select a “Destination Folder” or use the default one
- Wait for it to finish installing, then drag and mount it to your Applications folder
How to Install Python on Linux
To install Python on Linux we do not need to download the install from the python.org website, but can instead install it through the Linux terminal:
- Open your BASH command line terminal (press “CTRL+ALT+T” to open it)
- Type: “sudo apt-get update”
- Press “Enter“
- Type: “sudo apt install python3”
- Press “Enter“
- Enter your Linux password
- Press “Enter“
- Type: “Y” for yes
- Wait for it to finish installing
How to Install Python Conclusion
I hope you enjoyed this tutorial on how to install Python. We first looked into how to check if you already have Python installed, and if so what version you have running. We then covered the key methods of installing or upgrading a current installation of Python on either Windows, MacOS or Linux.
With Python now installed, you can take the next steps in learning how to use Python and write some Python code in the Python Interpreter or Command Line Terminals found in your Operating System (OS).
While the Python Interpreter allows us to write some Python code, it doesn’t actually allow us to compile, run or save our code. In order to do this, we need an IDE (Integrated Development Environment) (such as PyCharm for Python), or Text Code Editor, of which there is also a great selection to choose from.
If you enjoyed this content and would like others to benefit from it as well, make sure to share it on your favorite Social Media platform, using the share buttons below.