Installing Python 3.4

Note: There are many ways to get a stable install of Python onto your system – I personally go with pyenv – but the Anaconda package from Continuum Analytics seems to ably fill all of our needs while being as simplified of a cross-platform installation process as possible.

Currently, the instructions below walk through the installation process for OS X 10.7+, but the steps in Windows should largely be the same. I'll update this page with more instructions if it turns out alternatives to Anaconda are needed.

The Anaconda installation package is 300MB by itself. When installed, Anaconda's Python will take up 1.9GB.

The following steps are for Max OS X 10.7+, though they should be similar for Windows system. The important part is to make sure you're downloading the 3.4 installer (and not the 2.7 version of Python).

To run this code, you can do one of two things: Create a Python script and run it from the command-line. Or, execute the code, line-by-line, in iPython.

Create a Python script and run it from the command-line

Create a new text file named example.py

Write the commands given above into example.py

Save the file

From the command-line prompt, run this command:

python example.py

You should see this result:

http://www.iana.org/domains/example

Here's an animated GIF of the process:

Execute code in iPython

iPython is a command-line interface that lets you interactively execute code line-by-line. The end result is the same as writing a script and running it through the python interpreter, as demonstrated above. The difference is that with iPython, you can walk through the code as you execute it line-by-line.

This of course is slower than just putting code in a script file and executing it. But when you don't know yet what the code should be, iPython is a great environment for tinkering with code and seeing how each command works.

Here's an animated GIF of the process. Note that at line 4, I hit the Tab key to do an autocomplete, hence, the weird break in the code:

Speaking of the Tab key: taking the 5 to 10 minutes to build the muscle memory needed to reflexively hit Tab to autocomplete commands in iPython is one of the easiest things you can do to increase your short- and long-term success rate at programming.