Internet of Things with Python
上QQ阅读APP看书,第一时间看更新

Installing pip and additional libraries

By default, the pip package management system that makes it easy to install and manage software packages written in Python isn't installed. We are going to use Python as our main programming language, and therefore, we will definitely benefit from installing pip.

Enter the following curl command to download the get-pip.py file from https://bootstrap.pypa.io, into the current folder.

curl -L "https://bootstrap.pypa.io/get-pip.py" > get-pip.py

You will see an output similar to the following lines that will indicate the download progress:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1379k  100 1379k    0     0   243k      0  0:00:05  0:00:05 --:--:--  411k

Once the download has finished, run python with get-pip.py as an argument.

python get-pip.py

You will see an ouput similar to the following lines that will indicate the installation progress and a few warnings related to the SSLContext. Don't worry about the warnings.

Collecting pip
/tmp/tmpe2ukgP/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB)
    100% |################################| 1.1MB 11kB/s 
Collecting wheel
  Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB)
    100% |################################| 65kB 124kB/s 
Installing collected packages: pip, wheel
Successfully installed pip-7.1.2 wheel-0.26.0
/tmp/tmpe2ukgP/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

Now, we can use the pip installer to easily install additional Python 2.7.3 packages. We will use the pip installer to get the wiring-x86 package from PyPI, the Python Package Index, and install it. The wiring-x86 package is a Python module that provides a simple API similar to the WiringPi module to use the general purpose I/O pins on the Intel Galileo Gen 2 board and other supported platforms. We just need to run the following command to install the package:

pip install wiring-x86

The last lines for the ouput will indicate that the wiring-x86 package has been successfully installed. Don't worry about the error messages related to building a wheel for wiring-x86.

Installing collected packages: wiring-x86
  Running setup.py install for wiring-x86
Successfully installed wiring-x86-1.0.0