Knowledge Base

The AB Electronics UK Knowledge Base provides support solutions, tutorials and troubleshooting guides.

Using Pythonpath with the Python Libraries

Created 31/01/2016 | Adding the library path to startup

This page details how to add the PYTHONPATH and PATH variables on the Raspbian “Wheezy” and "Jessie" image from to use with our Python 2 and 3 libraries allowing you to use the libraries from your scripts from any directory on your Raspberry Pi.

Step 1: Download and extract the library to the directory of your choice, i.e ABElectronics_Python_Libraries/ADCPi

Step 2: Use CD to change to the directory containing the library files.

cd ABElectronics_Python_Libraries/ADCPi

Step 3: Use the pwd command to obtain the full directory path.


This will return the full path to the directory: /home/pi/Desktop/ABElectronics_Python_Libraries/ADCPi

Step 3 a:  We now edit the .bashrc file to include the library folder in the PATH and PYTHONPATH variables

sudo nano ~/.bashrc

Step 4:  Add the following lines to the .bashrc file at the end, replace this demo path to the correct location on your computer.

export PATH


Save your changes and exit the Nano editor.

Step 5: Reboot to apply the changes

sudo reboot

When your Raspberry Pi has rebooted you will now have PYTHONPATH to the library setup for Python 2 or 3 support.