To run the SmartMeshSDK sample applications directly from source code you need to have Python installed and you also need some additional Python packages. This is only necessary if you wish to modify the behavior of the sample apps. This process is also required for running the applications on systems that cannot directly run Windows executables, such as Linux.
Python installation instructions are different for 32-bit and 64-bit versions of Windows. Please follow the appropriate set of instructions below. |
Most modern OSes come with Python pre-installed. To check if you have Python installed, open a command prompt (DOS window) and type:
C:\Python27\python.exe --version |
It should print out something like:
Python 2.7.8 |
If you installed Python using Anaconda, Python will be in a different location. |
Follow the appropriate instructions for your operating system:
python-2.7.12.msi
.PySerial adds serial port support to Python.
Download PySerial for Python 2.7 from http://sourceforge.net/projects/pyserial/files/pyserial/.
At the time of writing, the latest version was pyserial-2.5.
Make sure to install PySerial for Python 2.7, e.g. Do not install PySerial for Python 3.0, e.g. |
This step is optional. It's not necessary unless you want to run the Serial Mux Configurator from source. The Serial Mux Configurator can be run from its executable form.
PyWin32 adds Windows-specific support to Python. While most applications in the SmartMeshSDK are platform independent, some like the Serial Mux Configurator have platform-specific requirements. PyWin32 provides different installers for various Python versions.
Unless you know that you need to run the 64-bit version of Python and PySerial for some other purpose, you should run the 32-bit version. Follow the instructions above. |
python-2.7.12.amd64.msi
.Installing Pyserial is done differently for 64-bit Windows 7. It is a two step process:
ez_setup.py
from the link in the instructions there.ez_setup.py
file that you downloaded, by double-clicking on the script icon. This should result in the creation of a folder named Scripts in your Python folder. easy_install.exe
script from the step above. The easy_install.exe
script should be in your Python folder, e.g., C:\Python27\Scripts. (This folder might be a different place if you specified a different location when you installed Python.)easy_install.exe
and supply "pyserial" as a command line argument, e.g. easy_install.exe pyserial
This step is optional. It's not necessary unless you want to run the Serial Mux Configurator from source. The Serial Mux Configurator can be run from its executable form.
PyWin32 adds Windows-specific support to Python. While most applications in the SmartMeshSDK are platform independent, some like the Serial Mux Configurator have platform-specific requirements. PyWin32 provides different installers for various Python versions
Python 2.7 is part of the standard Ubuntu distribution. If python is not present, you can install it with the Ubuntu package manager.
$ sudo apt-get install python2.7 python-pip |
PySerial can be installed with the Ubuntu package manager.
$ sudo apt-get install python-serial |
Python 2.7 is part of the standard OS distribution. If python is not present, you can use a package manager like MacPorts to install it:
$ sudo port install python27 |
PySerial can be obtained here. Follow the installation instructions in the /documentation/pyserial.rst file.
/src/
directory, then to the bin/InstallTest
directoryInstallTest.py
If your installation is complete, a Python command window will open with the following text:
Installation test script - Dust Networks SmartMeshSDK Step 1. Python version You are running Python 2.7.1 PASS Step 2. PySerial installation PASS Press Enter to exit. |
PASS
.Some of the SmartMeshSDK sample applications require additional Python packages to be installed. For consistency, all of the required packages are listed together even though no single application depends on all of the packages being present. In special cases, the README document may list additional requirements.
The required packages are listed in the requirements.txt file. If you cloned or downloaded the source files from GitHub, the requirements file is found in the root directory. If you downloaded the latest full release with both source files and windows executables, the requirements file is located in the /src
directory.
You can install the packages directly from the requirements file using pip:
$ pip install -r requirements.txt |
The The best practice is to use virtualenv to install the required SMSDK packages in a virtual environment to avoid package conflicts with other Python projects. Instructions on using virtualenv are beyond the scope of this document, but there are many good references available on the Internet. |