This is the first in a three-part series that introduces Python to absolute beginners.

Parts 1 and 2 walk through installing Python and the IDLE interface and installing Python via Anaconda, respectively. Part 3 covers the essential elements of Python so you can get started with Python asap.

Python is not only one of the fastest growing languages, it’s also an essential for doing machine learning, AI, and data science. So why wouldn’t you want to install it? 😝

🤖 Table of Contents 🤖
How to install Python
Quick tour
Choosing the best IDE

How to install Python

Fun fact: installing Python is so easy to install it only takes two steps.

Step 1: Check if Python is already installed

Before you install Python it’s a good idea to make sure you don’t have a version already installed on your computer.

If you have a Mac, odds are you actually already have Python installed since most models now ship with it. Still, you should check what version you have and, if necessary, update it to the most recent version. More on that later.

If you have windows you’ll probably have to install Python yourself but you should still double check that it isn’t already installed.

Here’s how you check whether Python is installed on Mac:

  1. Open Spotlight.
  2. Search for Terminal and launch it.
  3. Type python into the open window.
  4. Terminal will print out the version of Python that your computer is currently running.

Here’s how to check whether you have Python installed on Windows:

  1. Go to the Windows search bar.
  2. Type in command and then select Command Prompt from the search results.
  3. Type py into the open window.
  4. If installed, Command Prompt will print your computer’s version of Python.

Currently, there are two main versions of Python, version 2.7 and 3.5 or later. Aside from a few syntactical differences, the two versions are pretty similar. However, support for version 2 will fade over time so all python-based tutorials on Elle Knows Machines are written for Python 3.

It’s generally recommended to update your version of Python to the most recent version. Luckily, updating Python and installing Python from scratch follow the same process, so if either of these applies to you keep reading 🙌

Step 2: Install Python

Told you this was going to be easy!

To install Python on Mac:

  1. Go to the Python website and download the latest version of Python for Mac here:
  2. Once it’s downloaded, launch the .pkg file by clicking on it.
  3. Walk through the installer. You’ll have to agree to Python’s Terms and Conditions and the installer will also prompt you for your username and password.
  4. Your computer should open the Python 3.X folder. If not, you can find it in the Applications folder.
  5. Double-click IDLE to launch Python.

To install Python on Windows:

  1. Go to the Python website and download the latest version of Python for Windows here:
  2. Once downloaded, click on the .exe file to launch the installer.
  3. Walk through the installer. You’ll have to agree to Python’s Terms and Conditions and the installer might also prompt you for your username and password.
  4. Go to the Window search bar and type IDLE. Clicking on this will open Python.

A quick tour of IDLE

IDLE is what’s known as an integrated development environment (IDE) and automatically comes bundled with installs of Python. We’ll talk a little bit more about what IDEs are in the next section but basically, IDLE is a text editor that allows you to instantly begin writing and editing Python code.

It’s hands down the quickest and easiest way to get started with Python on your own computer.

IDLE has two parts: the shell and the editor window, both of which we’ll take a tour of now ✨

The shell

When you open IDLE the shell window is the first thing to pop up.

The first lines in the shell show you what version of Python you’re running, which in my case is version 3.7.0

You can then type your code directly into the window, hit enter, and it will run straight away. This is a good place to test out quick code, however, nothing can be saved from the shell. Any outputs, messages, or errors are also displayed here.

Want to give it a spin?

Type in the following and then hit enter:2+2


The editor window

Since the shell can’t actually save code, the editor window is where most work is done. It’s pretty much just like any other text editor but with a few built-in tools that help you write code and troubleshoot any errors.

To open up the editor window click on the File at the top of your screen and choose New File. An empty editor window will appear. You’ll need to save the file before you can run it by going to FileSave As.

To run your code hit F5 or RunRun Module.  Go ahead and test it out 👍

IDLE also color codes your code. This is a big help when you’re writing programs with longer blocks of text because it’s easier to see the structure of your code.

Choosing the best IDE: IDLE vs Anaconda vs others

As mentioned, IDLE is a type of IDE.

IDEs are a coding tool that allow you to easily write, test, and debug your code.

While you technically can write code in anything that lets you write letters and numbers such as Word, Notes, or another text editor, IDEs take the code you’ve written and let you to run it from within the IDE interface itself. This means you can check that everything is working right away, without installing any other software or opening any extra programs.

IDEs also tend to come with a number of other tools that make coding more comfortable (and fun?!) such as code completion, debugging, and resource management.

So, obviously, IDEs all the way. But which one is the best?

Turns out, there are a lot of IDEs out there and a quick Google search will yield pages and pages of results discussing lots of opinions about which is best.

IMO there are two must-have IDEs for someone looking to a) learn Python and b) become a machine learning superstar: IDLE and Anaconda.

IDLE is great for getting started with Python quickly. It’s really fast and lightweight which means you can open it and begin playing around without wasting time waiting around for a program to launch. It just feels lighter.

IDLE is great when working through introductory Python tutorials or when you’re working on a smaller-scale Python specific project. There are other IDEs out there that have great interfaces and all the bells and whistles, but you probably don’t need and almost definitely won’t use those as a beginner.

If you’re planning to do any kind of machine learning or data science with Python in the future, then Anaconda is the way to go.

Anaconda provides an open source distribution of Python and comes with 250+ of the most popular Python data science packages pre-loaded. This means that with a single download and quick install you’ll have all of the major tools ready to go. And for the most part – they just work. This is a really big deal when future you is trying to get things done.

You can also just install Python and then individually install all of the required packages using something called PIP, but this is time consuming and finicky. Installing with PIP can lead you down a rabbit hole which could be avoided if you’d just installed Anaconda in the first place.

Anaconda’s default IDE is called Spyder. Spyder not only integrates all of the libraries essential for machine learning, but it was built specifically for data science. It’s quick and easy to pick up and includes features like syntax highlighting, code completion, and a well designed variable explorer. Plus, Spyder’s interface is similar to RStudio which is a bonus if you ever plan to learn R.

Learn how to install Anaconda here.

In the wild

What do you think? Do you have a favorite IDE? I’d love to hear your thoughts 💖