Before the first lecture...

Introduction to PythonVT17

We require you to have a laptop (with Linux, or Mac) for the practical exercises. If you do not have one, or want to borrow one from us, please contact us at before the beginning of the course.

Before the first lecture, we have the 3 following requirements:

  1. Install Python on your machine (obviously),
  2. Check that the installation went fine, by running a given simple script,
  3. Make sure you have a proper text editor

How to install Python

On the Python website, the latest version available is 3.6.0. Please, choose to install the version 3.5.0 or above. You can install the latest Python on Windows, Mac OS X or Linux/Unix.

On Windows

You can borrow a Linux laptop where we have installed Python 3.5+ for you. If you insist on using your own Windows machine, here are the installation steps on Windows. The installer should look like:

Installing Python with a Windows MSI

On Mac OS X

Since Mac OS X 10.8, Python 2.7 is pre-installed by Apple. This is an incompatible version with this course. You should instead download the installer for the version 3.5.0 (or choose a newer one), double-click and follow the instructions.

Installing Python on Mac OS X

More information can be found on

IMPORTANT NOTE: If you are not interested in a system-wide version of Python3, you can use pyenv to easily switch between multiple versions of Python. You can install pyenv from GitHub. After installation, you can install version 3.5.0 by issuing the following command in your Terminal.

$ pyenv install 3.5.0

On Linux/Unix

You probably know what to do if we give you the Python 3.5.0 sources. You are surely familiar with the classic cycle:

make test
sudo make install

Testing your installation

Start your favorite terminal and check the Python version. Type at the prompt (ie where the $ sign is):

$ python --version

or start the python interpretor

$ python

Running a test script

Download this test script (from the NBIS GitHub location for this instance of the course), and in your terminal, run

$ python

…in the folder where the script resides. If this works fine, you should see the current time printed with “big digits” ;)

successful test

Alternatively, copy-paste that line at the prompt

curl -s | python

Using a proper Text Editor

We are going to type (a lot of) Python code, so you’d better have a good text editor. This is useful for several reasons: The text editor can highlight the Python keywords and handles the particulars regarding tabulations (which we will introduce in the course).

Emacs and Vim are probably the best text editors, albeit for tech-savvy people. If you are not the latter kind, Sublime Text or Atom are excellent cross-platform alternative. You should probably customize it to your taste first.

Sublime Text and Python

Jupyter notebooks

In the course, we will write Python code as standalone files. However, during the lecture, we will also use Jupyter notebooks. Jupyter is a web-based tool which allows us to evaluate our code line by line. The Jupyter files are called notebooks and will serve a single purpose in this course: a quick demonstration of Python code. It is therefore convenient, though optional, to install Jupyter in advance.

Running the notebook

Impatient about the first lecture?

Whet your appetite on the Python tutorial or an informal introduction to Python.