pynmea2安装

11 篇文章 0 订阅
该博客记录了在Ubuntu系统中使用pip安装Python2.7版本的pynmea2库时遇到的问题。首先,尝试通过apt-get安装pip失败,然后通过curl下载并安装pip,但因Python2.7已不再支持而报错。最终,成功安装了pip,并在Python2环境中安装了pynmea2库。然而,在运行pynmea2示例代码时遇到了编码问题,通过将`open`替换为`io.open`解决了问题。
摘要由CSDN通过智能技术生成

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')

 


~


 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值