Python使用pip安裝pySerial串口通訊模塊
pySerial封裝了對(duì)串口的訪問(wèn),供大家參考,具體內(nèi)容如下
特性
在支持的平臺(tái)上有統(tǒng)一的接口。
通過(guò)python屬性訪問(wèn)串口設(shè)置。
支持不同的字節(jié)大小、停止位、校驗(yàn)位和流控設(shè)置。
可以有或者沒(méi)有接收超時(shí)。
類(lèi)似文件的API,例如read和write,也支持readline等。
支持二進(jìn)制傳輸,沒(méi)有null消除,沒(méi)有cr-lf轉(zhuǎn)換。
有關(guān)Python的環(huán)境配置請(qǐng)參考: 《Python入門(mén)》Windows 7下Python Web開(kāi)發(fā)環(huán)境搭建筆記
而 pip 是隨 Python 一同安裝的,如下圖:
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 來(lái)安裝非常簡(jiǎn)單,只需使用以下命令:pip install pyserial。
安裝時(shí)可能會(huì)出現(xiàn)以下提示:
可以按照提示執(zhí)行升級(jí) pip:pip install --upgrade pip
也可以不升級(jí) pip,我上面的圖是已經(jīng)安裝過(guò)了。沒(méi)有安裝的話(huà)會(huì)如下圖顯示:
有時(shí)候會(huì)出現(xiàn)類(lèi)似下圖的網(wǎng)絡(luò)錯(cuò)誤:
重新執(zhí)行一遍就可以了
卸載可使用命令:pip uninstall pyserial
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Python?OpenCV超詳細(xì)講解透視變換的實(shí)現(xiàn)
OpenCV用C++語(yǔ)言編寫(xiě),它具有C?++,Python,Java和MATLAB接口,并支持Windows,Linux,Android和Mac?OS,OpenCV主要傾向于實(shí)時(shí)視覺(jué)應(yīng)用,并在可用時(shí)利用MMX和SSE指令,本篇文章帶你通過(guò)OpenCV實(shí)現(xiàn)透視變換2022-04-04在pycharm上mongodb配置及可視化設(shè)置方法
今天小編就為大家分享一篇在pycharm上mongodb配置及可視化設(shè)置方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-11-11python通過(guò)安裝itchat包實(shí)現(xiàn)微信自動(dòng)回復(fù)收到的春節(jié)祝福
這篇文章主要介紹了python通過(guò)安裝itchat包實(shí)現(xiàn)微信自動(dòng)回復(fù)收到的春節(jié)祝福,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2020-01-01Python內(nèi)置函數(shù)reversed()用法分析
這篇文章主要介紹了Python內(nèi)置函數(shù)reversed()用法,結(jié)合實(shí)例形式分析了reversed()函數(shù)的功能及針對(duì)序列元素相關(guān)操作技巧與使用注意事項(xiàng),需要的朋友可以參考下2018-03-03對(duì)Matlab中共軛、轉(zhuǎn)置和共軛裝置的區(qū)別說(shuō)明
這篇文章主要介紹了對(duì)Matlab中共軛、轉(zhuǎn)置和共軛裝置的區(qū)別說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-05-05不到40行代碼用Python實(shí)現(xiàn)一個(gè)簡(jiǎn)單的推薦系統(tǒng)
這篇文章主要給大家介紹了如何利用不到40行python代碼實(shí)現(xiàn)一個(gè)簡(jiǎn)單的推薦系統(tǒng),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Python具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05Python使用正則表達(dá)式分割字符串的實(shí)現(xiàn)方法
今天小編就為大家分享一篇Python使用正則表達(dá)式分割字符串的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-07-07