Installation

The following installation instructions are provided to install, upgrade, and uninstall the LibsensorPy libraries, examples, utility scripts, etc. directly on your Rasbperry Pi. These instructions are not intended to install LibsensorPy on your development workstation or other computer. For development conducted on a computer other than the Raspberry Pi, please access the compressed LibsensorPy via download them directly import them in your project.


Prerequisites

Configure and enable SPI and I2C ports on Raspperry

Download and install python-smbus and i2c-tools:

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

For Raspbian users, check /etc/modprobe.d/raspi-blacklist.conf and comment "blacklist i2c-bcm2708" and "blacklist spi-bcm2708" by running:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

And adding a # (if its not there):

  • # blacklist i2c-bcm2708
  • # blacklist spi-bcm2708

RPi.GPIO Native Library

LibsensorPy depends on the raspberry-gpio-python native library by Ben Croston. Please see the following page for more information on raspberry-gpio-python.
https://pypi.python.org/pypi/RPi.GPIO

Installing RPi_GPIO:

sudo apt-get update
sudo apt-get install python-dev python-rpi.gpio

Pigpio Library

Pigpio is a C library for the Raspberry which allows control of the general purpose input outputs (gpios). Please see the following page for more information on Pigpio.
http://abyz.co.uk/rpi/pigpio/

Installing Pigpio:

wget abyz.co.uk/rpi/pigpio/pigpio.zip
unzip pigpio.zip
cd PIGPIO
sudo make
sudo make install

Setuptools

If you are installing LibsensorPy without using pip, you will need to install setuptools too:

sudo apt-get install python-setuptools


Installation

Easy/Preferred

(NOTE: This installation method requires that your RaspberryPi is connected to the Internet.)

The simplest method to install LibsensorPy on your RaspberryPi is to execute the following command directly on your RaspberryPi.

sudo pip install libsensorPy

This method will download and launch an installation script that perform the following steps:

  1. Download LibsensorPy files.
  2. Install LibsensorPy to the standard location for third-party Python modules. On Raspberry it is generally located at /usr/local/lib/pythonX.Y/site-packages

Offline/Manual

If you prefer/need to install LibsensorPy on a RaspberryPi device without an Internet connection, the following instructions provide the steps necessary to install LibsensorPy without requiring an Internet connection.

First, download a copy of the latest LibsensorPy compressed (.tar.gz) file to your local computer. You can download the LibsensorPy using your web browser at the following URL:
http://libsensorpy.com//dld/libsensorPy-0.0.7.tar.gz

Next, you will need to transfer the download compressed file over to your RaspberryPi. You can use any method you prefer to transfer the file (USB, SCP, FTP, etc.)

(NOTE: If you have a previous version of LibsensorPy installed, you will need to uninstall it first.)

Once the compressed file is available on your RaspberryPi, use the following command on the Pi to perform the installation:

tar -zxvf libsensorPy-0.0.7.tar.gz
cd libsensorPy-0.0.7/
sudo python setup.py install


Upgrade

Easy/Preferred

If you originally installed LibsensorPy using the 'easy' method, then LibsensorPy upgrades will be available anytime you perform a system update using 'sudo apt-get update' and 'sudo update-get upgrade'.

If you wish to force an upgrade of the LibsensorPy package only, you can do so by executing the following command:

sudo pip install LibsensorPy --upgrade

Offline/Manual

If you originally installed LibsensorPy using the 'offline' method, then you will need to manually uninstall the LibsensorPy module and download, transfer, and install the new version module using the 'offline' uninstall and installation methods described here on this page.


Uninstall

If you originally installed LibsensorPy using the 'easy' method, then you can uninstall LibsensorPy simply by executing the following command on your RaspberryPi.

sudo pip uninstall LibsensorPy



Visitors: 88880