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中安装easy_install的方法
Nov 18 Python
Python Excel处理库openpyxl使用详解
May 09 Python
pandas.read_csv参数详解(小结)
Jun 21 Python
Python使用线程来接收串口数据的示例
Jul 02 Python
Python collections中的双向队列deque简单介绍详解
Nov 04 Python
基于python使用tibco ems代码实例
Dec 20 Python
Python文件操作函数用法实例详解
Dec 24 Python
mac在matplotlib中显示中文的操作方法
Mar 06 Python
Pycharm生成可执行文件.exe的实现方法
Jun 02 Python
Python无损压缩图片的示例代码
Aug 06 Python
Python try except else使用详解
Jan 12 Python
Python+Matplotlib图像上指定坐标的位置添加文本标签与注释
Apr 11 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 url地址栏传中文乱码解决方法集合
2010/06/25 PHP
解析curl提交GET,POST,Cookie的简单方法
2013/06/29 PHP
php冒泡排序、快速排序、快速查找、二维数组去重实例分享
2014/04/24 PHP
thinkphp配置连接数据库技巧
2014/12/02 PHP
phpmyadmin提示The mbstring extension is missing的解决方法
2014/12/17 PHP
laravel框架中路由设置,路由参数和路由命名实例分析
2019/11/23 PHP
javascript 获取页面的高度及滚动条的位置的代码
2010/05/06 Javascript
js查找某元素中的所有图片地址的方法
2014/01/16 Javascript
使用JS获取当前地理位置方法汇总
2014/12/18 Javascript
jQuery实现渐变弹出层和弹出菜单的方法
2015/02/20 Javascript
JavaScript中数据结构与算法(四):串(BF)
2015/06/19 Javascript
JavaScript如何实现对数字保留两位小数一位自动补零
2015/12/18 Javascript
浅析jQuery Ajax请求参数和返回数据的处理
2016/02/24 Javascript
详细谈谈javascript的对象
2016/07/31 Javascript
js 获取元素所有兄弟节点的实现方法
2016/09/06 Javascript
微信小程序实现两边小中间大的轮播效果的示例代码
2018/12/07 Javascript
JavaScript Array对象使用方法解析
2019/09/24 Javascript
nodejs对mongodb数据库的增加修删该查实例代码
2020/01/05 NodeJs
Vue-resource安装过程及使用方法解析
2020/07/21 Javascript
详解python3中socket套接字的编码问题解决
2017/07/01 Python
用Python实现读写锁的示例代码
2018/11/05 Python
Python创建一个空的dataframe,并循环赋值的方法
2018/11/08 Python
Window10下python3.7 安装与卸载教程图解
2019/09/30 Python
Python中使用Selenium环境安装的方法步骤
2021/02/22 Python
欧洲最大的婴幼儿服装及内衣公司:Petit Bateau(小帆船)
2016/08/16 全球购物
全球高级音频和视频专家:HiDef Lifestyle
2019/08/02 全球购物
美国优质马术服装购买网站:Breeches.com
2019/12/16 全球购物
意大利辅助药品、药物和补品在线销售:FarmaEurope
2020/04/29 全球购物
高一历史教学反思
2014/01/13 职场文书
师生聚会感言
2014/01/26 职场文书
2014年端午节演讲稿范文
2014/05/23 职场文书
企业总经理任命书
2014/06/05 职场文书
甜品蛋糕店创业计划书
2014/09/21 职场文书
教师党员自我评议不足范文
2014/10/19 职场文书
创先争优活动个人总结
2015/03/04 职场文书
个人业务学习心得体会
2016/01/25 职场文书