Sunday, March 29, 2015

Install numpy, matplotlib and drawnow for Python 2

This post show steps to install numpy, matplotlib and drawnow for Python 2 on Raspberry Pi, to prepare my exercise "Display Raspberry Pi CPU temperature graphically, using Python 2 with Matplotlib". The steps are same as in other Linux such as Ubuntu.

To check if your system have numpy, matplotlib and drawnow installed, enter the command in Python Shell:

>>> import numpy
>>> import matplotlib
>>> import drawnow

If you get error message like this, you have to install it.
ImportError: No module named numpy
ImportError: No module named matplotlob
ImportError: No module named drawnow

Install numpy, matplotlib and drawnow for Python 2:
$ sudo apt-get install python-numpy
$ sudo apt-get install python-matplotlib
$ sudo apt-get install python-pip
$ sudo pip install drawnow

For Python 3:

To install numpy and drawnow for Python 3 on Raspberry Pi, enter the command:
Install for Python 3:
$ sudo apt-get install python3-numpy
$ sudo apt-get install python3-pip
$ sudo pip-3.2 install drawnow

For matplotlib for Python 3, it seem not supported on Raspbian currently. I tried to build from source, refer to the post "Fail to build matplotlib for Python3, run on Raspberry Pi 2".

No comments: