1. install
ubuntu:~$ sudo apt-get install pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pip
ubuntu:~$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1882k 100 1882k 0 0 19541 0 0:01:38 0:01:38 --:--:-- 32642
ubuntu:~$
ubuntu:~$ python get-pip.py
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/2.7/get-pip.py instead.
ubuntu:~$ curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1863k 100 1863k 0 0 34655 0 0:00:55 0:00:55 --:--:-- 26360
ubuntu:~$ python get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip<21.0
Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
|ΖΖΖΖΖΖΖΖΖΖΖΖΖΖΖΖ| 1.5 MB 309 kB/s
Collecting setuptools<45
Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
|ΖΖΖΖΖΖΖΖΖΖΖΖΖΖΖΖ| 583 kB 6.3 MB/s
Collecting wheel
Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.3.4 setuptools-44.1.1 wheel-0.36.2
ubuntu:~$
ubuntu:~$ pip install pynmea2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pynmea2
Downloading pynmea2-1.16.0.tar.gz (30 kB)
Building wheels for collected packages: pynmea2
Building wheel for pynmea2 (setup.py) ... done
Created wheel for pynmea2: filename=pynmea2-1.16.0-py2-none-any.whl size=27827 sha256=2d72ef313aae82f8a161df8206503016f936180689a1cf4b4c1b70bcbee134a8
Stored in directory: /home/jasonfan/.cache/pip/wheels/32/70/a4/e0cb05320aabe53e07dedeb57fb8ead56d48fb3c26cbf6dd04
Successfully built pynmea2
Installing collected packages: pynmea2
Successfully installed pynmea2-1.16.0
ubuntu:~$
2.test
(1)@ubuntu:~/pynmea2/examples$ python ./read_file.py
Traceback (most recent call last):
File "./read_file.py", line 4, in <module>
file = open('data.log','r',encoding='utf-8')
TypeError: 'encoding' is an invalid keyword argument for this function
solve:
>import io
>file = io.open('data.log','r',encoding='utf-8')
~