To get started working with Python 3, you’ll need to have access to the Python interpreter. There are several common ways to accomplish this:
Alternatively, there are several websites that allow you to access a Python interpreter online without installing anything on your computer at all.
Note: There is a chance that Python may have been shipped with your operating system and is already installed. Even if that is the case, it may be that the installed version is outdated, in which case you will want to obtain the latest version anyhow.
In this Python installation guide, you’ll see step by step how to set up a working Python 3 distribution on Windows, macOS, Linux, iOS, and Android. So let’s get started!
It is highly unlikely that your Windows system shipped with Python already installed. Windows systems typically do not. Fortunately, installing does not involve much more than downloading the Python installer from the python.org website and running it. Let’s take a look at how to install Python 3 on Windows:
Sidebar: 32-bit or 64-bit Python?
For Windows, you can choose either the 32-bit or 64-bit installer. Here’s what the difference between the two comes down to:
- If your system has a 32-bit processor, then you should choose the 32-bit installer.
- On a 64-bit system, either installer will actually work for most purposes. The 32-bit version will generally use less memory, but the 64-bit version performs better for applications with intensive computation.
- If you’re unsure which version to pick, go with the 64-bit version.
Note: Remember that if you get this choice “wrong” and would like to switch to another version of Python, you can just uninstall Python and then re-install it by downloading another installer from python.org.
Once you have chosen and downloaded an installer, simply run it by double-clicking on the downloaded file. A dialog should appear.
Important: You want to be sure to check the box that says Add Python 3.x to PATH as shown to ensure that the interpreter will be placed in your execution path.
Then just click Install Now. That should be all there is to it. A few minutes later you should have a working Python 3 installation on your system.
While current versions of macOS (previously known as “Mac OS X”) include a version of Python 2, it is likely out of date by a few months. Also, this tutorial series uses Python 3, so let’s get you upgraded to that.
The best way we found to install Python 3 on macOS is through the Homebrew package manager. This approach is also recommended by community guides like The Hitchhiker’s Guide to Python.
To get started, you first want to install Homebrew:
At this point, you’re likely waiting for the command line developer tools to finish installing, and that’s going to take a few minutes. Time to grab a coffee or tea!
You can continue installing Homebrew and then Python after the command line developer tools installation is complete:
Whew! Now that the Homebrew package manager is set up, let’s continue on with installing Python 3 on your system.
Once Homebrew has finished installing, return to your terminal and run the following command:
$ brew install python3 |
Note: When you copy this command, be sure you don’t include the $
character at the beginning. That’s just an indicator that this is a console command.
This will download and install the latest version of Python. After the Homebrew brew install
command finishes, Python 3 should be installed on your system.
You can make sure everything went correctly by testing if Python can be accessed from the terminal:
pip3
and hit Enter.pip3
, go through the Python install steps again to make sure you have a working Python installation.Assuming everything went well and you saw the output from Pip in your command prompt window…congratulations! You just installed Python on your system, and you’re all set to continue with the next section in this tutorial.
[Reference: https://realpython.com/installing-python/]