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实现的一个简单LRU cache
Sep 26 Python
Linux下使用python自动修改本机网关代码分享
May 21 Python
Python 40行代码实现人脸识别功能
Apr 02 Python
python实现Floyd算法
Jan 03 Python
Pycharm 设置自定义背景颜色的图文教程
May 23 Python
Sanic框架路由用法实例分析
Jul 16 Python
Pycharm更换python解释器的方法
Oct 29 Python
Django 创建新App及其常用命令的实现方法
Aug 04 Python
Django框架教程之中间件MiddleWare浅析
Dec 29 Python
解决Python图形界面中设置尺寸的问题
Mar 05 Python
pycharm 2020.2.4 pip install Flask 报错 Error:Non-zero exit code的问题
Dec 04 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
PHP5中MVC结构学习
2006/10/09 PHP
我的论坛源代码(八)
2006/10/09 PHP
php共享内存段示例分享
2014/01/20 PHP
phpmyadmin中禁止外网使用的方法
2014/11/04 PHP
php实现将数组转换为XML的方法
2015/03/09 PHP
php+ajax实现无刷新动态加载数据技术
2015/04/28 PHP
从刷票了解获得客户端IP的方法
2015/09/21 PHP
PHP创建单例后台进程的方法示例
2017/05/23 PHP
帮助避免错误的Javascript陷阱清单
2009/05/31 Javascript
神奇的7个jQuery 3D插件整理
2011/01/06 Javascript
jquery miniui 教程 表格控件 合并单元格应用
2012/11/25 Javascript
js里取容器大小、定位、距离等属性搜集整理
2013/08/19 Javascript
jquery.post用法关于type设置问题补充
2014/01/03 Javascript
JavaScript中实现单体模式分享
2015/01/29 Javascript
JS实现鼠标滑过链接改变网页背景颜色的方法
2015/10/20 Javascript
Bootstrap弹出框modal上层的输入框不能获得焦点问题的解决方法
2016/12/13 Javascript
EasyUI Tree树组件无限循环的解决方法
2017/09/27 Javascript
node.js部署之启动后台运行forever的方法
2018/05/23 Javascript
React组件重构之嵌套+继承及高阶组件详解
2018/07/19 Javascript
解决layui调用自定义方法提示未定义的问题
2019/09/14 Javascript
Vue路由权限控制解析
2020/11/09 Javascript
[03:19]2016国际邀请赛中国区预选赛第四日TOP10镜头集锦
2016/07/01 DOTA
python实现的各种排序算法代码
2013/03/04 Python
Python使用filetype精确判断文件类型
2017/07/02 Python
Python DataFrame 设置输出不显示index(索引)值的方法
2018/06/07 Python
Python并发之多进程的方法实例代码
2018/08/15 Python
使用python爬取微博数据打造一颗“心”
2019/06/28 Python
Python实现上下文管理器的方法
2020/08/07 Python
python tkinter的消息框模块(messagebox,simpledialog)
2020/11/07 Python
CSS3实现歌词进度文字颜色填充变化动态效果的思路详解
2020/06/02 HTML / CSS
html5使用Drag事件编辑器拖拽上传图片的示例代码
2017/08/22 HTML / CSS
企业总经理助理岗位职责
2014/09/12 职场文书
2014年信访工作总结
2014/11/17 职场文书
导游词之西递宏村
2019/12/10 职场文书
Keras在mnist上的CNN实践,并且自定义loss函数曲线图操作
2021/05/25 Python
Win11黑色桌面背景怎么办?Win11黑色壁纸解决方法汇总
2022/04/05 数码科技