Merge pull request #383 from SteveAmor/document_version_query

Document how to get the gpiozero version number
This commit is contained in:
Dave Jones
2016-08-14 14:02:26 +01:00
committed by GitHub

View File

@@ -70,3 +70,26 @@ In this case, all references to items within GPIO Zero must be prefixed::
button = gpiozero.Button(2)
How can I tell what version of gpiozero I have installed?
=========================================================
The gpiozero library relies on the setuptools package for installation
services. You can use the setuptools ``pkg_resources`` API to query which
version of gpiozero is available in your Python environment like so::
>>> from pkg_resources import require
>>> require('gpiozero')
[gpiozero 1.2.0 (/usr/local/lib/python2.7/dist-packages)]
>>> require('gpiozero')[0].version
'1.2.0'
If you have multiple versions installed (e.g. from ``pip`` and ``apt-get``)
they will not show up in the list returned by the ``require`` method. However,
the first entry in the list will be the version that ``import gpiozero`` will
import.
If you receive the error "No module named pkg_resources", you need to install
the ``pip`` utility. This can be done with the following command in Raspbian::
$ sudo apt-get install python-pip