Install Python on your computer

Background

Before you can run any Python code, you have to install a Python interpreter on your computer. The interpreter is what reads, translates, and executes your Python code (which is just a text file with a .py extension). At this point that's the most you need to know. Don't get bogged down in the technical jargon for now.

Python, like any language or piece of software, is constantly evolving, so there are a bunch of versions floating around. There are a few differences between Python 2 and Python 3. I recommend you learn Python 3. The latest version distributed with Miniconda as of August 2019 is Python 3.7.

Because Python is open source, there are many people/organizations that offer distributions of it. We'll use the Anaconda distribution. I use the Anaconda distribution (specifically Miniconda) because it uses the package manager conda, which allows you to easily install Python packages, as well as create and manage Python environments. We'll discuss what those are and why that's valuable later. For now, let's just get to the good stuff.

Download and install miniconda

Windows Tip: Make sure you allow the installer to add Python to your PATH environment variable, and install the single user version (especially if you don't have Admin rights on your machine).

Test that it worked

Open the command line. On Windows open the Command Prompt, and on macOS open Terminal.

Issues?

Hopefully, the two commands above didn't produce any error messages. If they did, copy-paste the message into Google. You will find the answer ;).

If you get a message like python or conda command not recognized, then you most likely need to add your miniconda3 installation to your system Path.

By the way, learning a bit about the command line (Terminal/PowerShell) will be helpful as you start programming more. If you're interested in some details you can read this primer for command line.

Hopefully that wasn't too painful, and everything worked as expected. Let's run your first Python code.


Next post: Run your first Python code

Previous post: Python for Everyone: Introduction