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检测lvs real server状态
Jan 22 Python
python实现linux服务器批量修改密码并生成execl
Apr 22 Python
python获取mp3文件信息的方法
Jun 15 Python
Python实现遍历目录的方法【测试可用】
Mar 22 Python
python获取代码运行时间的实例代码
Jun 11 Python
详解python编译器和解释器的区别
Jun 24 Python
python pytest进阶之xunit fixture详解
Jun 27 Python
Python笔记之工厂模式
Nov 20 Python
将 Ubuntu 16 和 18 上的 python 升级到最新 python3.8 的方法教程
Mar 11 Python
Pyspark获取并处理RDD数据代码实例
Mar 27 Python
Python+OpenCV图像处理——图像二值化的实现
Oct 24 Python
安装不同版本的tensorflow与models方法实现
Feb 20 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源码分析之变量的存储过程分解
2014/07/03 PHP
php时间戳格式化显示友好的时间函数分享
2014/10/21 PHP
php数组保存文本与文本反编成数组实例
2014/11/13 PHP
phpstorm配置Xdebug进行调试PHP教程
2014/12/01 PHP
tp5.0框架隐藏index.php入口文件及模块和控制器的方法分析
2020/02/11 PHP
用Greasemonkey 脚本收藏网站会员信息到本地
2009/10/26 Javascript
基于jQuery的Tab选项框效果代码(插件)
2011/03/01 Javascript
jQuery中andSelf()方法用法实例
2015/01/08 Javascript
AngularJS基础学习笔记之控制器
2015/05/10 Javascript
省市区三级联动jquery实现代码
2020/04/15 Javascript
Bootstrap表单使用方法详解
2017/02/17 Javascript
Vue实现动态显示textarea剩余字数
2017/05/22 Javascript
jQuery 实现倒计时天,时,分,秒功能
2018/07/31 jQuery
深入理解Node内建模块和对象
2019/03/12 Javascript
Python2中的raw_input() 与 input()
2015/06/12 Python
Python的Django框架可适配的各种数据库介绍
2015/07/15 Python
Python中的条件判断语句基础学习教程
2016/02/07 Python
Python中列表元素转为数字的方法分析
2016/06/14 Python
python中的文件打开与关闭操作命令介绍
2018/04/26 Python
Python实现删除时保留特定文件夹和文件的示例
2018/04/27 Python
如何使用Python的Requests包实现模拟登陆
2018/04/27 Python
详解python3中tkinter知识点
2018/06/21 Python
Python enumerate函数功能与用法示例
2019/03/01 Python
利用python和百度地图API实现数据地图标注的方法
2019/05/13 Python
使用npy转image图像并保存的实例
2020/07/01 Python
在线学习西班牙语、法语或其他语言:Babbel.com
2018/02/07 全球购物
公司前台接待岗位职责
2013/12/03 职场文书
活动邀请函范文
2014/01/19 职场文书
小学新教师培训方案
2014/02/03 职场文书
小学中秋节活动方案
2014/02/06 职场文书
销售经理岗位职责
2014/03/16 职场文书
运动会搞笑广播稿
2014/10/14 职场文书
2014年超市工作总结
2014/11/19 职场文书
升学宴家长答谢词
2015/09/29 职场文书
创业计划书之都市休闲农庄
2019/12/28 职场文书
一篇文章了解正则表达式的替换技巧
2022/02/24 Javascript