Python使用pip安装pySerial串口通讯模块


Posted in Python onApril 20, 2018

pySerial封装了对串口的访问,供大家参考,具体内容如下

特性

在支持的平台上有统一的接口。
通过python属性访问串口设置。
支持不同的字节大小、停止位、校验位和流控设置。
可以有或者没有接收超时。
类似文件的API,例如read和write,也支持readline等。
支持二进制传输,没有null消除,没有cr-lf转换。

有关Python的环境配置请参考: 《Python入门》Windows 7下Python Web开发环境搭建笔记

而 pip 是随 Python 一同安装的,如下图:

Python使用pip安装pySerial串口通讯模块

pip 帮助信息,在命令行中输入 pip 就能看到以下的帮助信息

G:\>pip 
 
Usage: 
 pip <command> [options] 
 
Commands: 
 install           Install packages. 
 uninstall          Uninstall packages. 
 freeze           Output installed packages in requirements format. 
 list            List installed packages. 
 show            Show information about installed packages. 
 search           Search PyPI for packages. 
 wheel            Build wheels from your requirements. 
 help            Show help for commands. 
 
General Options: 
 -h, --help         Show help. 
 --isolated         Run pip in an isolated mode, ignoring 
               environment variables and user configuration. 
 -v, --verbose        Give more output. Option is additive, and can be 
               used up to 3 times. 
 -V, --version        Show version and exit. 
 -q, --quiet         Give less output. 
 --log <path>        Path to a verbose appending log. 
 --proxy <proxy>       Specify a proxy in the form 
               [user:passwd@]proxy.server:port. 
 --retries <retries>     Maximum number of retries each connection should 
               attempt (default 5 times). 
 --timeout <sec>       Set the socket timeout (default 15 seconds). 
 --exists-action <action>  Default action when a path already exists: 
               (s)witch, (i)gnore, (w)ipe, (b)ackup. 
 --trusted-host <hostname>  Mark this host as trusted, even though it does 
               not have valid or any HTTPS. 
 --cert <path>        Path to alternate CA bundle. 
 --client-cert <path>    Path to SSL client certificate, a single file 
               containing the private key and the certificate 
               in PEM format. 
 --cache-dir <dir>      Store the cache data in <dir>. 
 --no-cache-dir       Disable the cache. 
 --disable-pip-version-check 
               Don't periodically check PyPI to determine 
               whether a new version of pip is available for 
               download. Implied with --no-index.

安装 pySerial 串口通讯模块

使用 pip 来安装非常简单,只需使用以下命令:pip install pyserial

安装时可能会出现以下提示:

Python使用pip安装pySerial串口通讯模块

可以按照提示执行升级 pip:pip install --upgrade pip

Python使用pip安装pySerial串口通讯模块

也可以不升级 pip,我上面的图是已经安装过了。没有安装的话会如下图显示:

Python使用pip安装pySerial串口通讯模块

有时候会出现类似下图的网络错误:

Python使用pip安装pySerial串口通讯模块

重新执行一遍就可以了

Python使用pip安装pySerial串口通讯模块

卸载可使用命令:pip uninstall pyserial

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持三水点靠木。

Python 相关文章推荐
在Python中使用判断语句和循环的教程
Apr 25 Python
python获取当前时间对应unix时间戳的方法
May 15 Python
Python采用Django开发自己的博客系统
Sep 29 Python
python正则实现提取电话功能
Feb 24 Python
浅谈pycharm出现卡顿的解决方法
Dec 03 Python
Python多进程方式抓取基金网站内容的方法分析
Jun 03 Python
python3.7 利用函数os pandas利用excel对文件名进行归类
Sep 29 Python
Python range与enumerate函数区别解析
Feb 28 Python
pycharm无法安装第三方库的问题及解决方法以scrapy为例(图解)
May 09 Python
Python 开发工具通过 agent 代理使用的方法
Sep 27 Python
python编程的核心知识点总结
Feb 08 Python
pytorch 权重weight 与 梯度grad 可视化操作
Jun 05 Python
pandas apply 函数 实现多进程的示例讲解
Apr 20 #Python
python3+PyQt5图形项的自定义和交互 python3实现page Designer应用程序
Jul 20 #Python
Python查找两个有序列表中位数的方法【基于归并算法】
Apr 20 #Python
pandas 使用apply同时处理两列数据的方法
Apr 20 #Python
Python之pandas读写文件乱码的解决方法
Apr 20 #Python
python3+PyQt5实现自定义窗口部件Counters
Apr 20 #Python
Python cookbook(字符串与文本)在字符串的开头或结尾处进行文本匹配操作
Apr 20 #Python
You might like
php中可能用来加密字符串的函数[base64_encode、urlencode、sha1]
2012/01/16 PHP
解析thinkphp中的M()与D()方法的区别
2013/06/22 PHP
CI框架中集成CKEditor编辑器的教程
2014/06/09 PHP
PHP定时更新程序设计思路分享
2014/06/10 PHP
从刷票了解获得客户端IP的方法
2015/09/21 PHP
在html页面中包含共享页面的方法
2008/10/24 Javascript
javascript 年月日联动实现核心代码
2009/12/21 Javascript
为JavaScript类型增加方法的实现代码(增加功能)
2011/12/29 Javascript
通过jQuery源码学习javascript(一)
2012/12/27 Javascript
js判断undefined变量类型使用typeof
2013/06/03 Javascript
jquery使用jquery.zclip插件复制对象的实例教程
2013/12/04 Javascript
Node.js入门教程:在windows和Linux上安装配置Node.js图文教程
2014/08/14 Javascript
js倒计时抢购实例
2015/12/20 Javascript
jQuery height()、innerHeight()、outerHeight()函数的区别详解
2016/05/23 Javascript
15款最好的Bootstrap在线编辑器
2016/08/03 Javascript
node+vue实现用户注册和头像上传的实例代码
2017/07/20 Javascript
详解JavaScript中的数组合并方法和对象合并方法
2018/05/11 Javascript
Vue动态控制input的disabled属性的方法
2018/06/26 Javascript
js刷新页面location.reload()用法详解
2019/12/09 Javascript
vue-cli设置publicPath小记
2020/04/14 Javascript
js+cavans实现图片滑块验证
2020/09/29 Javascript
vue 避免变量赋值后双向绑定的操作
2020/11/07 Javascript
Python SQLite3数据库日期与时间常见函数用法分析
2017/08/14 Python
python paramiko模块学习分享
2017/08/23 Python
3个用于数据科学的顶级Python库
2018/09/29 Python
Python3将数据保存为txt文件的方法
2019/09/12 Python
浅析Python面向对象编程
2020/07/10 Python
python 绘制场景热力图的示例
2020/09/23 Python
日本航空官方网站:JAL
2019/06/19 全球购物
中职生自荐信
2013/10/13 职场文书
企业节能减排实施方案
2014/03/19 职场文书
民主生活会剖析材料
2014/09/30 职场文书
教师自查自纠材料
2014/10/14 职场文书
通知函的格式
2015/04/27 职场文书
司法廉洁教育心得体会
2016/01/20 职场文书
iOS 16进一步确认,一共支持16款iPhone
2022/04/28 数码科技