At the command line:
$ pip install minimalmodbus
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv minimalmodbus $ pip install minimalmodbus
Python versions 2.7 and higher are supported (including 3.x). Tested with Python 2.7, 3.2, 3.3 and 3.4. This module is pure Python.
Alternate installation on Linux¶
From command line (if you have the pip installer, available at https://pypi.python.org/pypi/pip):
pip install -U minimalmodbus
sudo pip install -U pyserial sudo pip install -U minimalmodbus
You can also manually download the compressed source files from https://pypi.python.org/pypi/MinimalModbus/ (see the end of that page). In that case you first need to manually install pySerial from https://pypi.python.org/pypi/pyserial.
There are compressed source files for Unix/Linux (.tar.gz) and Windows (.zip). To install a manually downloaded file, uncompress it and run (from within the directory):
python setup.py install
sudo python setup.py install
If using Python 3, then install with:
sudo python3 setup.py install
For Python3 there might be problems with easy_install and pip. In that case, first manually install pySerial and then manually install MinimalModbus.
To make sure it is installed properly, print the _getDiagnosticString() message. See the Support section for instructions.
You can also download the source directly from Linux command line:
Change version number to the appropriate value.
Downloading from Github:
wget https://github.com/pyhys/minimalmodbus/archive/master.zip unzip master.zip
This will create a directory ‘minimalmodbus-master’.
Alternate installation on Windows¶
Install from Github, using pip:
C:\Python34\Scripts>pip3.4 install https://github.com/pyhys/minimalmodbus/archive/master.zip
It will be installed in:
In order to run Python from command line, you might need:
If everything else fails¶
You can download the raw minimalmodbus.py file from GitHub, and put it in the same directory as your other code. Note that you must have pySerial installed.