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实现两个list对应元素相减操作示例
Jun 09 Python
Python编程之string相关操作实例详解
Jul 22 Python
用TensorFlow实现lasso回归和岭回归算法的示例
May 02 Python
python list是否包含另一个list所有元素的实例
May 04 Python
Anaconda2下实现Python2.7和Python3.5的共存方法
Jun 11 Python
python中datetime模块中strftime/strptime函数的使用
Jul 03 Python
详解PyTorch手写数字识别(MNIST数据集)
Aug 16 Python
python 采用paramiko 远程执行命令及报错解决
Oct 21 Python
Python实现图片识别加翻译功能
Dec 26 Python
如何快速一次性卸载所有python包(第三方库)呢
Oct 20 Python
Python基础学习之奇异的GUI对话框
May 27 Python
Python中tqdm的使用和例子
Sep 23 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
iis下php mail函数的sendmail配置方法(官方推荐)
2012/04/25 PHP
windows下zendframework项目环境搭建(通过命令行配置)
2012/12/06 PHP
浅析PKI加密解密 OpenSSL
2013/07/01 PHP
类之Prototype.js学习
2007/06/13 Javascript
JavaScript访问样式表代码
2010/10/15 Javascript
提高jQuery性能的十个诀窍
2013/11/14 Javascript
javascript读取Xml文件做一个二级联动菜单示例
2014/03/17 Javascript
学习jQuey中的return false
2015/12/18 Javascript
javascript实现checkbox复选框实例代码
2016/01/10 Javascript
jQuery实现每隔几条元素增加1条线的方法
2016/06/27 Javascript
js以分隔符分隔数组中的元素并转换为字符串的方法
2016/11/16 Javascript
JS限定手机版中图片大小随分辨率自动调整的方法
2016/12/05 Javascript
vue.js在标签属性中插入变量参数的方法
2018/03/06 Javascript
详解Vue的常用指令v-if, v-for, v-show,v-else, v-bind, v-on
2018/10/12 Javascript
vue实现div拖拽互换位置
2020/07/29 Javascript
了解在JavaScript中将值转换为字符串的5种方法
2019/06/06 Javascript
Python的Django框架安装全攻略
2015/07/15 Python
Python实战小程序利用matplotlib模块画图代码分享
2017/12/09 Python
Python中数组,列表:冒号的灵活用法介绍(np数组,列表倒序)
2018/04/18 Python
python多个模块py文件的数据共享实例
2019/01/11 Python
对python 调用类属性的方法详解
2019/07/02 Python
python3字符串操作总结
2019/07/24 Python
python 5个顶级异步框架推荐
2020/09/09 Python
pytorch学习教程之自定义数据集
2020/11/10 Python
高清屏中使用Canvas绘图出现模糊的问题及解决方法
2019/06/03 HTML / CSS
中国领先的专业家电网购平台:国美在线
2016/12/25 全球购物
ziaja齐叶雅官方海外旗舰店:来自波兰的天然护肤品牌
2017/01/02 全球购物
C语言如何决定使用那种整数类型
2016/11/26 面试题
超市5.1促销活动
2014/01/15 职场文书
超市后勤自我鉴定
2014/01/17 职场文书
《湘夫人》教学反思
2014/02/21 职场文书
拒绝黄毒毒宣传标语
2014/06/26 职场文书
男方婚礼答谢词
2015/01/20 职场文书
学生会主席任命书
2015/09/21 职场文书
一篇文章学会Vue中间件管道
2021/06/20 Vue.js
SpringCloud的JPA连接PostgreSql的教程
2021/06/26 Java/Android