Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raspberry Pi - GPIO in Python

I am trying to get my Raspberry Pi's GPIO pins working, and I am following Tutorial: How to use your Raspberry Pi like an Arduino.

( I'm working through SSH running Raspbian.) I have successfully installed distribute.

When trying to install PIP, I get the error shown below.

How can I fix it?

    pi@DuckPi ~ $ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 85929  100 85929    0     0  89250      0 --:--:-- --:--:-- --:--:--  103k
    Downloading/unpacking pip
      Running setup.py egg_info for package pip

        warning: no files found matching '*.html' under directory 'docs'
        warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
        no previously-included directories found matching 'docs/_build/_sources'
    Installing collected packages: pip
      Running setup.py install for pip
        error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied
        Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt:
        running install

    running build

    running build_py

    running install_lib

    creating /usr/local/lib/python2.7/dist-packages/pip

    error: could not create '/usr/local/lib/python2.7/dist-packages/pip': Permission denied

    ----------------------------------------
    Command /usr/bin/python -c "import setuptools;__file__='/home/pi/build/pip/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-6djiJW-record/install-record.txt failed with error code 1
    Storing complete log in /home/pi/.pip/pip.log
like image 811
ChrisPDuckling Avatar asked Dec 13 '12 18:12

ChrisPDuckling


People also ask

What is Raspberry Pi GPIO Python?

Raspberry-gpio-python or RPi. GPIO, is a Python module to control the GPIO interface on the Raspberry Pi. It was developed by Ben Croston and released under an MIT free software license. The project Wiki has documentation including example programs.

What is GPIO library in Python?

GPIO library is another Python-only library. It provide basic interactions with the GPIO pins, but no implementation of any connection protocol yet. The projects python files can be downloaded from Pypi.org, the projects home page is hosted on Scourceforge.

What does GPIO setup 8 GPIO out instruction of Python in Raspberry Pi do?

GPIO to control the output ports of the Raspberry Pi. Once you can control outputs, you can, with a few additional electronic components, switch virtually anything on and off.


1 Answers

It's because curl was sudoed instead of python. You must do:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python

Or if you prefer, download the file and then run it:

$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ sudo python get-pip.py
like image 133
Hugo Tavares Avatar answered Nov 09 '22 14:11

Hugo Tavares