If you are using a Mac or Linux computer, the Python is already installed. If you are using Windows, then you will need to install it. In either case, you will also need to install the PySerial library to allow communication with the Arduino.

Install Python on Windows

To install Python on Windows, download the installer from http://www.python.org/getit/.

This project was built using Python 2.7.3

There are some reported problems with PySerial on Windows, using Python 3, so stick to Python 2.

Once Python is installed, you will find a new Program Group on your Start menu. However, we are going to make a change to Windows to allow you to use Python from the Command Prompt. You will need this to be able to install PySerial.

We are going to add something to the PATH environment variable.

To do this, you need to go to the Windows Control panel and find the System Properties control. Then click on the button labelled “Environment Variables” and in the window that pops-up select “Path” in the bottom section (System Variables). Click “Edit” and then at the end of the “Variable Value” without deleting any of the text already there, add the text: ;C:\Python27

Don't forget the ";" before the new bit!

To test that it worked okay, start a new Command Prompt (DOS Prompt) and enter the command “python”. You should see something like this:

Install PySerial

Whatever your operating system, download the .tar.gz install package for PySerial 2.6 from https://pypi.python.org/pypi/pyserial

This will give you a file called: pyserial-2.6.tar.gz

If you are using windows you need to uncompress this into a folder. Unfortunately, it is not a normal zip file, so you may need to download a tool such as 7-zip (http://www.7-zip.org/).

If you are using a Mac or Linux computer, then open a Terminal session, 'cd' to wherever you downloaded pyserial-2.6.tar.gz and then issue the following command to unpack the installation folder.

$ tar -xzf pyserial-2.6.tar.gz 

The rest of the procedure is the same whatever your operating system. Use you Comamnd Prompt / Terminal session and “cd” into the pyserial-2.6 folder, then run the command:

sudo python setup.py install

This guide was first published on Feb 28, 2013. It was last updated on Feb 28, 2013.

This page (Installing Python and PySerial) was last updated on Feb 28, 2013.

Text editor powered by tinymce.