This post will show you to get setup with Python so you can use it in your day to day work.

Why learn Python? Sounds like an awful lot of work. Boy and it’s pretty late in the afternoon already.

That’s not this post. When I’ve written that post, I’ll come back revisit that.

Table of Contents

Introduction

Pure python is good, but realistically you’ll need to install it with some common pieces of code for handling tasks (packages), things like data analysis, scraping URLs or regular expressions.

It’s easy to make mistakes when installing python and that’s why we’re going to just install Anaconda to accomplish this.

This will install python as well as lot of the common packages you’ll need.

Who is this guide for?

  • People who have never done anything with Python on their computer.

If you’ve fiddled with in the past, then there’s no guarantee any of this will work. It might, but you could also hit an edge case.

How to install Python on Windows

Head here. There are 4 download options:

  • 64-bit - Python 3.x
  • 32-bit - Python 3.x
  • 64-bit - Python 2.x
  • 32-bit - Python 2.x

You want to pick Python 3 and the correct version of Windows for you.

If you’re not sure if you’re on 64-bit or 32-bit windows you can check here.

Options that matter in the install

  • Install only for your user.
  • Add Anaconda to the PATH. - Although this is not recommended, this can prevent some issues when blindly following instructions on the internet. Which lets face it, is what we’ll be doing.
  • It may ask you to install Visual Studio during the install process. Say yes.

Everything should just work. Then open up the command prompt:

  • Hit windows key
  • Search for cmd and run it

Then type in python. You should see something like the following:

Python Console Python Console

Congratulations you’ve installed Python!

Important: You’ve also opened python on the command line. Just to be safe close it. You do that by typing exit().

Installing Python on Mac

Head here. There are 4 download options:

  • Python 3.x - Graphical Installer
  • Python 3.x - CLI Installer
  • Python 2.x - Graphical Installer
  • Python 2.x - CLI Installer

You want to pick Python 3 and the GUI installer.

Options that matter in the install

  • Install only for your user.
  • Add Anaconda to the PATH. Mac’s already come with Python, but if you’re blindly following instructions on the internet (which lets face it, is what we’ll be doing this can solve some problems.

Everything should just work. Open up Terminal:

Then type in python. You should see something like the screenshot in Windows. NBED Add in screenshot then exit

How do you use python?

There are two common ways you’ll probably end up using:

  1. You run a python script with the following command:

python this_is_my_script.py

  1. You open up a Jupyter Notebook and run code in there.

The first is quite self-explanatory. The second needs a little more explanation.

Using Jupyter Notebooks

One of the best things that Anaconda installs is Jupyter Notebooks.

You can run it by:

  • Opening up a command line (cmd or terminal) and typing in jupyter notebook.
  • By searching your system for it (on Windows at least it adds a shortcut to your start menu.)

Then a command line window will open up, this is just Jupyter notebook opening, don’t panic.

Jupyter opening in the cmd line Jupyter opening in the cmd line

Jupyter notebook will then automatically open in your browser.

When you open it, it’ll look like this:

Jupyter Notebook Jupyter Notebook

You navigate to the folder where you want to create a notebook and then click create. (Or click an existing one).

What loads is an interactive code environment.

Inside a Jupyter Notebook Inside a Jupyter Notebook

There’s quite a lot to it, but the basics are:

  • You can run each cell of code using Ctrl/Cmd + Enter and then the output will print out below.
  • You press enter on a cell to change the cell and type into it.
  • You press escape to be able to move up and down with the arrow keys and select cells.

It’s fantastic for data analysis and there are plenty of useful SEO notebooks I’ll be sharing in the future!

There’s plenty more to learn, but hopefully that’s enough to get you started!