We kick off this Python tutorial by learning to install Python on MacOS, Windows, and Linux. We will look at multiple installation methods per platform and discuss what I think is the best option.
Most of the time, using the official installer from the python.org website is not advisable. Instead, it’s better to go for the version packaged by your operating system. The advantage of an OS-supplied version is that you’ll get automatic updates.
Table of Contents
Install Python on Windows
There are three methods you can choose from on Windows.
With the official installer
You can download a Python installer from the official Python download website. I recommend this installation method if you are not an advanced computer user. Although this method does not give you automatic updates in the future, it does a great job of installing Python properly. Since it’s the official Python distribution, it’s well-tested, and it will be easier to ask for help if needed.
When you use this installer, mark the checkboxes that say ‘Add Python to PATH’ and ‘Install launcher’ as seen below:

In the following video, taken from my Python course for beginners, I demonstrate this installation process in detail:
Using The Microsoft Store
Microsoft hosts a community release of Python 3 in the Microsoft Store. This is also a great way to install Python on Windows because it handles updates automatically.
To use this method:
- Open the Microsoft Store and search for Python
- Pick the newest version and install it
Inside WSL
If you’re familiar with Windows Subsystem For Linux, you may also want to consider that option. It’s what I use myself, and I truly love it. It offers me the advantages that Windows offers (mainly great hardware support) while still enjoying Linux, which is, in my opinion, the best platform for Python development.
To install in WSL, you’ll first need to install WSL itself. Go for WSL2 if you can. It’s much better. After that, follow the Linux installation instructions below!
Installation on MacOS
On most versions of MacOS before Catalina, a distribution of Python is already included. Unfortunately, it’s almost certainly an old version, Python 2.7. Luckily, there are two ways to easily install Python 3 on a Mac.
Homebrew
First and foremost, I recommend looking into Homebrew. It allows you to install almost anything easily. The added benefits:
- Homebrew packages are usually very up-to-date.
- It’s also easy to upgrade to newer versions later on.
However, you must be comfortable using a command-line shell to use Homebrew. If that’s entirely new for you, I recommend the following option for now: using the official installer.
If you choose to install Homebrew, installing Python on MacOS is as easy as:
$ brew install python
Code language: Bash (bash)
Official installer
Alternatively, you can download an installer from the Python download website. It’s easy and works like the installation of any other MacOS software program. The downside to this approach is that you won’t get automatic updates. Just like with Windows, you should ensure that Python is added to your system’s PATH.
Install Python on Linux
There are several ways to install Python on Linux, that is if you need to install it at all!
Check what’s installed first
Most Linux distributions include Python. Many will include both Python 2 and Python 3.
If you enter python --version
on the command line, you’ll see the version number. It’s probably version 2.7:
$ python --version
Python 2.7.16
Code language: Bash (bash)
Unfortunately, you don’t want Python 2, but some OS’es still ship with it.
Now try python3 --version
. If you get a “command not found,” you must install Python 3. If your output looks similar to this, you’re in luck:
$ python3 --version
Python 3.8.5
Code language: Bash (bash)
Using a package manager
Depending on the distribution of Linux you are running, you can install Python with the default package manager: Yum, APT, etcetera. You’ll need to determine which package manager is used for your specific Linux distribution and how to use it.
If you’re on Ubuntu, Linux Mint, or Debian, you can install it using apt:
$ apt install python3 python-is-python3
Code language: Bash (bash)
This also installs a package called python-is-python3
, which makes the command python
point to python3
. Trust me when I say it will save you a lot of headaches later on.
Homebrew
Another interesting option for Linux is using Homebrew. That’s right, the package manager for Macs also works on Linux.
The major advantages of using Homebrew:
- You’ll get the latest version of Python, instead of the version your OS shipped with
- You don’t need root access to your system. All the software installed with Homebrew is installed in your home directory
I find myself using Homebrew more and more while working under Linux — give it a try!
Python in your browser
If you don’t feel like installing Python, or you cannot install it for whatever reason, I’ll offer an alternative, too: you can use Python right from your browser; no installation necessary!
Learn more
This article is part of a free Python tutorial. You can browse the tutorial with the navigation buttons at the top and bottom of the article or use the navigation menu. Want to learn more? All the Python installation methods also install a tool called pip. Pip is used to install Python packages that don’t come with the default Python installation. Later in this course, we’ll look extensively at how to use Pip and some alternatives that have even more to offer, like Python Poetry and Pipenv.
From what I understand, py is a Python launcher; a utility that comes with Python installations on Windows. It gets installed into C:\Windows\ so it’s available without requiring PATH modifications. At installation time, you should mark the checkbox “Add Python 3.X to PATH” and the python command should work as explained. So, using py you can at least launch it and get started, but you might want to reinstall and make sure python is added to the PATH.
I recommend Michael to try py –version .
I installed Python before founding your tutorial. I used the official website one and it was hard to understand why my Python did not work in CMD after installation.
After a couple of ours I found I had to use py –version instead python –version command. I think is a good think to note in your tutorial.
Hi Erik,
I installed the latest version from the web page.
But when I open the powershell and try the first command – python – nothing happens more than this
phyton : Die Benennung “phyton” wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines
ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern
enthalten), und wiederholen Sie den Vorgang.
But I have an icon in the program list named Phyton 3.9 and when I click it, a black input screen appears.
So why does it not work with the power shell ?The user variable is set.
I´m working on a brand new HP Spectre with Win10. And to my person – I have 40 years experience in Cobol on a mainframe.
Thanks for help
Michael
Hi Michael,
1. First of all, make sure it’s not just a typo. In the error you typed “phyton”.
2. If that doesn’t help, try python3 instead.
3. Also, when installing, make sure you mark the checkbox “Add Python 3.X to PATH” (see the cover image on this article for where to find this checkbox).
Hope that helps!