Setting up Python on Windows with Anaconda
Tags: python, tutorial, beginners, explainlikeimfive
Published: 2019-03-05 23:32:20

---
title: Setting up Python on Windows with Anaconda
published: true
tags: python,tutorial,beginners,explainlikeimfive
cover_image: https://katiekodes.com/images/spyderide_generic.png
canonical_url: https://katiekodes.com/setup-python-windows-anaconda/
---

I keep warning students not to use real, corporate CSV files in Python with online “IDEs” like [Repl.it](https://repl.it) or [CodeBunk](https://codebunk.com), and to install Python on your local machine instead.  **Finally, I’ve written a tutorial to walk you through it!**
  
These screenshots document the simplest approach I know of for installing Python on a Windows machine.

**THIS IS SO SIMPLE.**  You just download software, double-click the installer, let it run, open up the code editor, and execute your first `print('Hello World')` like magic.

But I'm here to walk you through every step and explain what's going on in the background.

If things don’t work and you can handle something a bit more complicated, see [my instructions on setting up “miniconda” on Windows](https://katiekodes.com/setup-python-windows-miniconda).

* * *

## Installing Anaconda & running a Python program

### Download

First, [download an appropriate installer file for “Anaconda”](https://www.anaconda.com/distribution/).

It’s not very smart about detecting that you’re on Windows, so explicitly click the “Windows” option just above the downloads.

![](https://katiekodes.com/images/screenshot-anaconda-01-download.png)

I recommend getting a 64-bit version, as long as your computer is 64-bit.

The only reason I can think of to have a 32-bit version on your computer is if, say, you’re going to be connecting to an Oracle database using “Oracle Client” software already installed on your computer, with that software being 32-bit _(e.g. because the database itself requires 32-bit clients)_.

Or, I suppose, if for some weird reason you have a 32-bit computer. But then you’re probably worried about “bloat” in things you install and would want to follow the more difficult [miniconda](https://katiekodes.com/setup-python-windows-miniconda) instructions anyway.

If what I just said didn’t make any sense, do 64-bit.

You want one for “Python 3.something,” not “Python 2.something.”

### Run the Anaconda installer

Double-click the “.exe” file to run setup. Click “ **Next** ,” then click “ **I Agree** ” on the following screen.

![](https://katiekodes.com/images/screenshot-anaconda-02-run.png)

![](https://katiekodes.com/images/screenshot-anaconda-03-run.png)

![](https://katiekodes.com/images/screenshot-anaconda-04-run.png)

### Choose “just me” or “all users”

I’m going to install this for “just me,” because I don’t have admin rights to install software on my corporate PC.

My choice here influences whether the installer suggests installing the program under:

- `C:\Users\MY_USERNAME\AppData\Local\Continuum\anaconda3` _(just me)_, or
- `C:\Program Files\Anaconda3` _(all users)_

![](https://katiekodes.com/images/screenshot-anaconda-05-justme.png)

### Installation folder

It bothers me to forget when software is installed in my `\AppData\Local\` hidden folders, so I am going to manually change the installation path on the next screen to `C:\Users\MY_USERNAME\Documents\ProgramFilesForSoftwareHatingSpaces\Continuum\anaconda3`.

Yes, I called that folder “`ProgramFilesForSoftwareHatingSpaces`” – I was feeling a bit pouty when Anaconda complained about my “Program Files” folder I’d set up under “My Documents.”

![](https://katiekodes.com/images/screenshot-anaconda-06-nospaces.png)

![](https://katiekodes.com/images/screenshot-anaconda-07-choosepath.png)

### Options

Next, the installer is going to ask me whether I want to do either of two things.

1. Add “Anaconda” to my “PATH” environment variable. It says not to do it right in the installer text, so I’m going to leave it un-checked.
2. Register “Anaconda” as my “default Python 3.7” environment. This comes checked, and they recommend it, and hey … let’s do it. I did.

Now I’ll click “ **Install**.”

![](https://katiekodes.com/images/screenshot-anaconda-08-checkboxes.png)

### While it runs

The installer takes a few minutes while it dumps thousands of small files onto your hard drive.

Q: Why so many files?

A: Your computer doesn’t naturally understand Python commands.

At a really low level, it understand commands in its “assembly language” _(which you wouldn’t want to have to write by hand)_.

All Windows computers are shipped understanding a language called “C” _(which, if you don’t want to become a professional programmer, you probably still wouldn’t want to have to write by hand)_.

Lots of support programs written in “C” teach your Windows computer how to understand commands written in “Python” _(presuming you, or a program like an “IDE” acting on your behalf, tell Windows where exactly you installed your software that can help parse these commands – for me, that would be **`C:\Users\MY_USERNAME\Documents\ProgramFilesForSoftwareHatingSpaces\Continuum\anaconda3\python.exe`** )_.

Furthermore, the full version of Anaconda comes with a _lot_ of Python “libraries” / “packages” / “modules” _(extensions to the base set of Python commands you can program with)_, all of which also have to have files on your computer so that your computer can understand what they mean.

If you don’t want so many of these, you could always [follow the more difficult instructions on setting up “miniconda” on Windows](https://katiekodes.com/setup-python-windows-miniconda) instead.

![](https://katiekodes.com/images/screenshot-anaconda-09-extracting.png)

### Finishing

When it says “Completed”, click “ **Next**.”

![](https://katiekodes.com/images/screenshot-anaconda-10-completed.png)

Don’t bother to install VSCode – it’s an “IDE” _(code editor)_, but you’re already getting another one called “Spyder” with this installation, and that will do you just fine. Click “ **Skip**.”

![](https://katiekodes.com/images/screenshot-anaconda-11-vscode.png)

Leave the “learn more” boxes checked, or un-check them, as you prefer, and click “ **Finish**.”

_(The second checkbox brings you [here](http://docs.anaconda.com/anaconda/user-guide/getting-started/); the first just brings you to Anaconda’s website.)_

![](https://katiekodes.com/images/screenshot-anaconda-12-finish-install.png)

* * *

## Write your first Python program

If you’ve practiced coding in an online “IDE” like [Repl.it](https://repl.it) or [CodeBunk](https://codebunk.com), you know that coding can be as easy as clicking a big “run” button every time you type enough text that you wonder what it does.

You have the same thing on your hard drive now! It’s called **Spyder**.

Anaconda’s installer installed it for you.

If you look at your “Start” menu _(the thing that pops up when you click the Windows icon in the bottom left corner of your screen)_, you may also notice a new folder called “**Anaconda3 (64-bit)**” with several icons beneath it.

Click the one that says “Spyder.”

![](https://katiekodes.com/images/screenshot-anaconda-14-startmenu.png)

The splash screen while it starts up looks like this:

![](https://katiekodes.com/images/screenshot-miniconda-19-runspyder.png)

And in your taskbar, once it’s up and running, its icon looks like this:

![](https://katiekodes.com/images/spydericon.png)

When it’s fully open, it’ll typically look something like this:

- On the left will be a place for you to edit code, with a new file called “untitled.py” _(tentatively proposing you save it in `C:\users\YOUR_USERNAME\untitled0.py`)_ whose contents are:

```python
# -*- coding: utf-8 -*-
"""
Created on SOME_TIMESTAMP

@author: YOUR_USERNAME
"""

```

On the right, or at the bottom right, will be some sort of “console” where you can watch code execute every time you hit the big green “run” button near the top of the screen _(it’s a right-facing green triangle)_.

![](https://katiekodes.com/images/screenshot-miniconda-20-spyderstart.png)

In the top menu, click “ **File** ” -> “ **Save As**.”

Pick a nice folder for your program _(personally, I’m going to save mine under `C:\example\`, but you might want to put it on your desktop)_ and save it there with a filename of “ **`hello.py`** ”.

_(Spyder’s “run” button complains if you try to run code before giving it a proper spot on your hard drive. You could just do file->save, but I personally can’t stand cluttering my `c:\users\MY_USERNAME\` with files like “untitled0.”)_

![](https://katiekodes.com/images/screenshot-miniconda-21-saveas.png)

_(Note that in the photo, mine is called “`hello2.py`” because I reused a screenshot from a different tutorial with 2 steps!)_

Now erase the entire contents of the file, and on line 1, type:

```python
print('Hello world')

```

Then click the big green “run” button.

You may see a pop-up dialog with all sorts of options about executing code consoles or interpreters and such.

Just click “cancel” on the pop-up dialog box and then click the play button again.

The pop-up box was giving you a chance to highly customize where you want to see any output from running your code.

Clicking “cancel” and trying again seems to tell Spyder, “you figure out where to display the output of this code, don’t bother me with all these options.”

_(Unfortunately, I didn’t catch this dialog box with a screenshot – Spyder seemed to remember my settings from my previous usage of it with “big Anaconda.”)_

Your output should look something like this – somewhere at the right-hand side of the screen, probably in a console called “Console 1/A,” you’ll see confirmation of the filepath of “ **`hello.py`** ,” followed by a new line with the text “`Hello World`”.

_(Note that in the photo, mine says “`Hello again`” because I reused a screenshot from a different tutorial with 2 steps!)_

![](https://katiekodes.com/images/screenshot-miniconda-22-run.png)

🎉🎊🙌

Congratulations – you’ve **written and run a Python program**!

🎈🎆👍🏾

In the top menu, click “ **File** ” -> “ **Save** ” because why not be proud of this working code? It’s good to get used to saving your work as soon as you like it.

But before we write a bigger program, let’s take a little diversion to learn about “modules.” They’re pretty important in Python.

* * *

## Modules

### Checking whether “modules” are installed

Now you need to learn what it looks like when a given extension to the Python language, also known as a “library” or “package” or, particularly in Python, a “module,” is installed.

Backspace out the entirety of your code and on line 1, type:

```python
import pandas

```

- Trivia: the orange warning triangle to the left of the line numbers in your code is telling you that you “imported” a package that your program doesn’t actually use anywhere else in the program. That’s Spyder trying to help you write better, more efficient code.
- Red circles with “x” in them to the left of the line numbers means a line doesn’t even contain legitimate Python to begin with. Those, you’ll want to care about, or your program won’t run.

#### Yay, it exists!

**Click the “run” button.**

If you **do** have the “pandas” module installed, nothing special happens.

You should have it installed – it comes with the “big”/mainstream version of Anaconda. Modules like Pandas is why Anaconda took so long to install!

If you have “pandas” installed, when you run this code, you just get another command prompt (“`In[SomeNumber]`”) in the box at the right where the number in square brackets is 1 bigger than it was before.

![](https://katiekodes.com/images/screenshot-miniconda-25-pandas-works.png)

_(Note: in the screenshot above, things look a slightly different because I’m still sooooo lazy and reusing screenshots from a different tutorial – sorry!)_

#### Boo, it doesn’t exist!

Let’s try “importing” a module you probably don’t have, because it doesn’t come with Anaconda.

Backspace out the entirety of your code and on line 1, type:

```python
import simple_salesforce

```

**Click the “run” button.**

If you get a huge dump of colorful text in your console, with the last few lines of the big error message saying the following, you now know that you don’t have the module called “`simple_salesforce`” installed:

```
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/example/hello.py", line 1, in <module>
    import simple_salesforce

ModuleNotFoundError: No module named 'simple_salesforce'

```

### Installing a “module”

Anaconda comes with just about everything you need as a total beginner, so don’t bother installing extra “modules” on your computer just yet.

However, if you ever need any, see [the “modules” section of my instructions on setting up “miniconda” on Windows](https://katiekodes.com/setup-python-windows-miniconda#modules) – people who install “miniconda” have to install all their own “modules” by hand, so I went over it step-by-step in those instructions!

* * *

## Write your second Python program

Backspace out the entirety of your code.

Copy and paste the following code into your code editor and run it:

```python
import pandas
pandas.set_option('expand_frame_repr', False)
filepath = 'https://raw.githubusercontent.com/pypancsv/pypancsv/master/docs/_data/sample1.csv'
df = pandas.read_csv(filepath)
print(df)

```

You should see the following output in your console at right:

```
      Id First Last Email Company
0 5829 Jimmy Buffet jb@example.com RCA
1 2894 Shirley Chisholm sc@example.com United States Congress
2 294 Marilyn Monroe mm@example.com Fox
3 30829 Cesar Chavez cc@example.com United Farm Workers
4 827 Vandana Shiva vs@example.com Navdanya
5 9284 Andrea Smith as@example.com University of California
6 724 Albert Howard ah@example.com Imperial College of Science

```

Now you’ve opened a CSV spreadsheet file with Python – you’re off to the races!

Head [here](https://pypancsv.github.io/pypancsv/quickexamples/) to learn new skills and put them in action on your computer.

* * *

## Happy Programming

You now have a working environment for editing CSV files in Python!

1. You have an “IDE,” or as I like to think of it, a “text editor with a run button,” called **Spyder** , that runs code you type into it as you see fit.
2. You know where to look to learn to install & update “modules” that you hear might be useful.  
_(Be careful and don’t trust any old module you find on the internet. It’s nothing more than “someone else’s code that you’re choosing to run on your computer.” Make sure it’s not from someone sketchy.)_