<commit_before># Getting started with Python bindings

## Overview

This tutorial will ensure that Mapnik and its Python bindings are properly installed and introduce you to some of the basic programming concepts for Mapnik.

## Step 1: check installation

Make sure you have mapnik installed. You should be able to open a terminal and type:

```sh
mapnik-config -v # should return a version number.
```

Next test the Python bindings. You should be able to open a terminal and type:

```sh
python -c "import mapnik;print mapnik.__file__" # should return the path to the python bindings and no errors
```

If the above does not work (e.g. throws an `ImportError`) then please go back and ensure Mapnik is properly installed.
## Step 2

Now, we need some data to render. Let's use a shapefile of world border polygons from [naturalearthdata.com](http://naturalearthdata.com) ([direct link](http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip)). Unzip the archive in an easily accessible location of your choosing. In *Step 3* we will be referencing the path to this shapefile in Python code, so make sure you know where you put it.

Once unzipped, you should see four files like:

```sh
ne_110m_admin_0_countries.shp
ne_110m_admin_0_countries.shx
ne_110m_admin_0_countries.dbf
ne_110m_admin_0_countries.prj
```

To download and unzip on the command line with the do:

```sh
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
unzip ne_110m_admin_0_countries.zip<commit_msg>Add link to Python bindings setup instructions.<commit_after># Getting started with Python bindings

## Overview

This tutorial will ensure that Mapnik and its Python bindings are properly installed and introduce you to some of the basic programming concepts for Mapnik.

## Step 1: check installation

Make sure you have mapnik installed. You should be able to open a terminal and type:

```sh
mapnik-config -v # should return a version number.
```

Next test the Python bindings. You should be able to open a terminal and type:

```sh
python -c "import mapnik;print mapnik.__file__" # should return the path to the python bindings and no errors
```

If the above does not work (e.g. throws an `ImportError`) then please go back and ensure [Mapnik](https://github.com/mapnik/mapnik/wiki/Mapnik-Installation) and the [Mapnik Python bindings](/README.md) are properly installed.
## Step 2

Now, we need some data to render. Let's use a shapefile of world border polygons from [naturalearthdata.com](http://naturalearthdata.com) ([direct link](http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip)). Unzip the archive in an easily accessible location of your choosing. In *Step 3* we will be referencing the path to this shapefile in Python code, so make sure you know where you put it.

Once unzipped, you should see four files like:

```sh
ne_110m_admin_0_countries.shp
ne_110m_admin_0_countries.shx
ne_110m_admin_0_countries.dbf
ne_110m_admin_0_countries.prj
```

To download and unzip on the command line with the do:

```sh
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
unzip ne_110m_admin_0_countries.zip
{'fraction_non_alphanumeric': 0.07520143240823635, 'fraction_numerical': 0.02208296031035512, 'mean_word_length': 4.975044563279857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '885597', 'n_tokens_mistral': 1079, 'n_tokens_neox': 978, 'n_words': 404}