如何在Python中使用pip安裝pySerial串口通訊模塊-創(chuàng)新互聯(lián)

這篇文章給大家介紹如何在Python中使用pip安裝pySerial串口通訊模塊,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

成都創(chuàng)新互聯(lián)專(zhuān)注于湖南企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,商城開(kāi)發(fā)。湖南網(wǎng)站建設(shè)公司,為湖南等地區(qū)提供建站服務(wù)。全流程按需策劃設(shè)計(jì),專(zhuān)業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,成都創(chuàng)新互聯(lián)專(zhuān)業(yè)和態(tài)度為您提供的服務(wù)

特性

在支持的平臺(tái)上有統(tǒng)一的接口。
通過(guò)python屬性訪(fǎng)問(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 一同安裝的,如下圖:

如何在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 來(lái)安裝非常簡(jiǎn)單,只需使用以下命令:pip install pyserial。

安裝時(shí)可能會(huì)出現(xiàn)以下提示:

如何在Python中使用pip安裝pySerial串口通訊模塊

可以按照提示執(zhí)行升級(jí) pip:pip install --upgrade pip

如何在Python中使用pip安裝pySerial串口通訊模塊

也可以不升級(jí) pip,我上面的圖是已經(jīng)安裝過(guò)了。沒(méi)有安裝的話(huà)會(huì)如下圖顯示:

如何在Python中使用pip安裝pySerial串口通訊模塊

有時(shí)候會(huì)出現(xiàn)類(lèi)似下圖的網(wǎng)絡(luò)錯(cuò)誤:

如何在Python中使用pip安裝pySerial串口通訊模塊

重新執(zhí)行一遍就可以了

如何在Python中使用pip安裝pySerial串口通訊模塊

卸載可使用命令:pip uninstall pyserial

關(guān)于如何在Python中使用pip安裝pySerial串口通訊模塊就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。

新聞標(biāo)題:如何在Python中使用pip安裝pySerial串口通訊模塊-創(chuàng)新互聯(lián)
瀏覽地址:http://muchs.cn/article2/dhgooc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、ChatGPT域名注冊(cè)、App開(kāi)發(fā)企業(yè)建站、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)