Raspberry Pi - Python中的GPIO

Chr*_*ing 4 pip gpio raspberry-pi

我试图让我的Raspberry Pi的GPIO引脚工作,我正在遵循教程:如何像Arduino一样使用你的Raspberry Pi.

(我正在通过运行Raspbian的SSH工作.)我已经成功安装了分发版.

在尝试安装PIP时,我收到如下所示的错误.

我该如何解决?

    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
Run Code Online (Sandbox Code Playgroud)

Hug*_*res 6

这是因为curlsudo编代替python.你必须这样做:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
Run Code Online (Sandbox Code Playgroud)

或者如果您愿意,请下载该文件然后运行它:

$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ sudo python get-pip.py
Run Code Online (Sandbox Code Playgroud)