How to use / install gps python library

root@raspberrypi:~# python
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gps import gps
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name gps
>>> exit ()

he does not work. Installed debian packages: gpsd, gpsd clients, python-gps, libgps20, libgps-dev

+3
source share
2 answers

I tried it on an Ubuntu machine and it worked fine:

$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gps import gps
>>>

First, make sure that the following files are present in the file (except that the directory is different from the other):

/usr/lib/pyshared/python2.7/gps/packet.so
/usr/lib/pyshared/python2.7/gps/clienthelpers.so
/usr/lib/python2.7/dist-packages/gps-3.6.egg-info
/usr/lib/python2.7/dist-packages/gps/misc.py
/usr/lib/python2.7/dist-packages/gps/client.py
/usr/lib/python2.7/dist-packages/gps/fake.py
/usr/lib/python2.7/dist-packages/gps/__init__.py
/usr/lib/python2.7/dist-packages/gps/gps.py

This can be done by doing:

dpkg -L python-gps

Also make sure that the directory in which python is running is not there gps.py, as this can damage the importer.

+3
source

, , gps.py gps.pyc, . u , .

+1

Source: https://habr.com/ru/post/1624917/


All Articles